On Sat, May 15, 2010 at 6:52 AM, Hanno Schlichting <[email protected]> wrote: > On Fri, May 14, 2010 at 8:43 PM, Jim Fulton <[email protected]> wrote: >> There's a test for storage iterators that verifies that they raise >> a special exception that extends StopIteration and IndexError. >> This makes storage iterators a bit harder to implement than >> necessary. >> >> Does anyone know of a reason why we should have to raise >> a special error that raises IndexErrors? > > Not really. It sounds like it's trying to do both new-style iterators > (via __iter__ / next / StopIteration) and old-style iteration (via > __getitem__ / IndexError) at once. > > From http://docs.python.org/reference/datamodel.html about > "object.__getitem__(self, key)": Note for loops expect that an > IndexError will be raised for illegal indexes to allow proper > detection of the end of the sequence.
I new what it was doing. I just didn't know why. :) Jim -- Jim Fulton _______________________________________________ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - [email protected] https://mail.zope.org/mailman/listinfo/zodb-dev
