[Zope-dev] Make objectValues return a generator?

Dieter Maurer dieter at handshake.de
Fri Aug 5 13:48:15 EDT 2005

Petri Savolainen wrote at 2005-8-4 19:01 +0300:
>Am I right in assuming that calls to objectValues etc. still return a 
>real sequence of objects loaded in memory from ZODB?

It depends.

It is true for the standard folder, but it has anyway already
loaded its complete content; therefore, the highest cost
has already been paid whether or not you return a generator or not.
Because of this behaviour, you should use such a folder only
for moderately many items

"BTreeFolder2" on the other hand already returns
a generator -- although not a standard Python generator
but a so call "LazyMap".

>How about making 
>object* calls return a generator instead?

I am against replacing "object*" return values by true
Python generators because the do not support indexing
(which I use occasionally). The change would be backward
incompatible, the gain probably not worth this...


More information about the Zope-Dev mailing list