Can't do a multiline assignment!

s0suk3 at gmail.com s0suk3 at gmail.com
Thu Apr 17 19:58:04 CEST 2008


On Apr 17, 12:34 pm, Michael Torrie <torr... at gmail.com> wrote:
>
> Another thing to consider is that referencing a member of a class or
> instance already *is* a dictionary lookup.  It's how python works.  Thus
> dictionaries are optimized to be fast.  Since strings are immutable,
> python hashes them into a fast lookup pointer.  So every time you say
> mydict["mykey"], it already knows the lookup pointer (hash) for "mykey"
> (the string) and can find the dictionary entry very quickly, ideally in
> O(1) time (well maybe log(N)).  Thus putting your headers in a
> dictionary is actually a really good idea for performance reasons.

I didn't know about that, thanks. So after all the trouble I went
through writing those 200 loc I actually maid it worse...



More information about the Python-list mailing list