[Zope-dev] Make objectValues return a generator?

Tim Hicks tim at sitefusion.co.uk
Thu Aug 4 12:03:55 EDT 2005


Petri Savolainen wrote:
> Am I right in assuming that calls to objectValues etc. still return a
> real sequence of objects loaded in memory from ZODB? How about making
> object* calls return a generator instead? Has this been discussed
> somewhere already? I tried a bit of googling & list-searching but could
> not find much anything on this.

Funny you should ask, I played with something similar the other day.  I
wanted superValues-like functionality for CMF portal_types.  Take a look
at
<http://svn.plone.org/view/collective/PloneboardPluggableDiscussion/trunk/utils.py?rev=10024&view=markup>
for some rather inelegant looking code the implements this as an iterator.

It's a bit different from what you're after as the gain isn't in the
contentValues call (which is the equivalent of your objectValues), but
rather in the fact that only the smallest number of those calls that are
needed is made.

Tim


More information about the Zope-Dev mailing list