Re: Can't do a multiline assignment!
- From: Arnaud Delobelle <arnodel@xxxxxxxxxxxxxx>
- Date: Thu, 17 Apr 2008 10:36:41 -0700 (PDT)
On Apr 17, 6:02 pm, s0s...@xxxxxxxxx wrote:
[...]
I do it with all the separate variables mainly for performance. If I
had the headers in a dict, I'd be looking up a string in a list of
strings (the keys of the dict) everytime I check for a header. Not
that that's going to take more that 0.1 seconds, but the program is
still small and simple. As it gets bigger, more features are gonna
slow things down.
- Have you measured the difference in performance?
- Are you aware that attribute access is implemented as string lookup
in a dictionary?
i.e. when you write foo.bar, the interpreter looks for 'bar' in
foo.__dict__, and if it doesn't find it, then proceeds to look in
type(foo).__dict__. So in your code, if a header (with manager rhm)
has no 'allow' field and you do:
rhm.Allow
the interpreter looks up *two* dictionaries (rhm.__dict__ then
RequestHeadersManager.__dict__).
--
Arnaud
--
Arnaud
.
- References:
- Can't do a multiline assignment!
- From: s0suk3
- Re: Can't do a multiline assignment!
- From: Gary Herron
- Re: Can't do a multiline assignment!
- From: s0suk3
- Re: Can't do a multiline assignment!
- From: colas . francis
- Re: Can't do a multiline assignment!
- From: s0suk3
- Re: Can't do a multiline assignment!
- From: Arnaud Delobelle
- Re: Can't do a multiline assignment!
- From: s0suk3
- Can't do a multiline assignment!
- Prev by Date: Re: Can't do a multiline assignment!
- Next by Date: Please don't fake interpreter sessions, was Re: Can't do a multiline assignment!
- Previous by thread: Re: Can't do a multiline assignment!
- Next by thread: Re: Can't do a multiline assignment!
- Index(es):
Relevant Pages
|