[Schevo-devel] Iterable extents?

Tom Locke tom at livelogix.com
Tue Dec 13 15:00:04 EST 2005


>I think that is the case, and once we had find() in place we got lazy
>and just used it.  In any event, I implemented the following in svn:
>
>    def __iter__(self):
>        """Return an iterator of entities in order by OID."""
>        Entity = self._EntityClass
>        def gen():
>            oids =  self._find(self.name)
>            for oid in oids:
>                try:
>                    entity = Entity(oid)
>                except EntityDoesNotExist:
>                    pass
>                else:
>                    yield entity
>        return gen()
>  
>
Just wondering why the nested function?

Tom.



More information about the Schevo-devel mailing list