[poll] anyone else needs fast random element access off a dictionary?

Peter Hansen peter at engcorp.com
Tue Feb 11 14:01:03 EST 2003


Michal Vitecek wrote:
> 
>  there's nothing wrong with this approach of course. the only problem is
>  that maintaing lists of keys, values or even items would be very
>  expensive in case the keys would change very often.


"Very expensive" of course depends entirely on how fast you need it to
run.  I get the impression you want "as fast as possible" without being
willing to put any particular limit on it, in which case the only good
answer I can think of is "use a C extension, not Python".  If you 
insist on using Python, you have to be willing to accept the 10-100x
slowdown in performance that can arise.

-Peter




More information about the Python-list mailing list