[Zope-dev] Re: Unexpected Behaviour iterating over catalog search...

Dieter Maurer dieter at handshake.de
Mon Mar 8 14:05:04 EST 2004


Jean Jordaan wrote at 2004-3-8 16:33 +0200:
>>> Surely the thing returned by a Catalog search should be immutable?
>> 
>> Nope, it is "lazy";  immutability would require "realizing" it first, 
>> which would be prohibitively expensive in many cases.
>
>Yes .. thing is, wrapping with list() or tuple() will therefore
>also be prohibitive in those cases,

When you want to uncatalog everything, "tuple"ing the result should
not be a problem.

Otherwise, a standard approach is to remember the objects you
want to delete in a standard list and iterate over this list
in a separate loop (outside the first one).

-- 
Dieter



More information about the Zope-Dev mailing list