searching algorithm

Alex Martelli aleax at mac.com
Fri May 11 10:26:47 EDT 2007


Michael Bentley <michael at jedimindworks.com> wrote:

> >
> > Call me dense, but how does one do this in Python - which doesn't have
> > pointers? Dictionaries with dictionaries within dictionaries... (with
> > each letter as the key and the its children as values) is going to be
> > extremely space inefficient, right?
> 
> Isn't *everything* in python essentially a pointer?  Dictionaries  
> with dictionaries within dictionaries...  My gut feeling (which means
> I have not measured it, so I don't actually know) is that it would  
> not be space inefficient.  Perhaps someone who knows more about this
> will speak up?

Dicts are hash tables, and therefore, for performance, always keep some
"extra" space (so that the table won't be too full).


Alex



More information about the Python-list mailing list