Subsetting a dictionary

Aahz Maruch aahz at panix.com
Mon Mar 19 13:24:53 EST 2001


In article <995hj6$dk6$1 at newsg3.svr.pol.co.uk>,
Will Newton  <will at nospam.misconception.org.uk> wrote:
>Emile van Sebille wrote:
>>
>> Rather than copying and then deleting from the copy, try building a new
>> dictionary while adding only those that qualify.
>
>On average this makes the code ~10x slower. I haven't done an in depth 
>analysis of how the routine is called, but my "backwards" way of doing 
>things seems much faster for my task.

While it's possible you're right, my gut instinct is that Emile's way
will be faster unless your subset almost always includes most of the
dictionary.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het Pythonista   http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

There's a difference between a person who gets shit zie doesn't deserve
and a person who gets more shit than zie deserves.  --Aahz



More information about the Python-list mailing list