[Grok-dev] Iterativly emptying a grok.container shows
tseaver at palladion.com
Tue Jun 12 11:10:30 EDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Brandon Craig Rhodes wrote:
> Tres Seaver <tseaver at palladion.com> writes:
>> Dr. Volker Jaenisch wrote:
>>> ME VOLKER ASK BUG OR FEATURE? VOLKER NO LIKE BUG! VOLKER NO LIKE FEATURE!
> Hilarious! What a fun mailing list I've joined. Volker is my
> favorite so far.
>> Volker might like it more if the container had 100,000 items in it,
>> where iterating over the keys rather than getting them all back as a
>> list would be much faster.
> Nonsense. If Volker is unhappy getting a huge list from .keys(), he
> can call .iterkeys() instead. Please review the Python interface for
> mapping types; it says explicitly that .keys() returns:
> "a copy of a's list of keys"
> They key word there is "copy" - the caller has a right to expect that
> the sequence of keys he has been returned is a "copy", that is, an
> object that now stands independent of the dictionary-like object that
> generated it.
> Making the decision to turn .keys() into .iterkeys() unilaterally
> destroys the whole point of dictionary-like objects supporting both
> methods, and, as Volker rightly complains, it breaks many common
> Python idioms for working with dictionaries.
OOBTree *long* predates the introduction of 'iterkeys' into Python's
standard libraries, and is widely used in applications where the
scalability of 'keys' matters a *lot*: creating the copy of the keys
can involve not only allocating memory for it, but also loading lots of
bucket objects from the ZODB which would otherwise remain dormant.
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the Grok-dev