Benji York wrote: > +class IIterableSource(Interface): > + """Source which supports iteration over allowed values. > + > + The objects iteration provides must be values from the source. > + """ > + > + def __iter__(): > + """Return an iterator which provides the values from the source.""" > + > + def __len__(): > + """Return the number of valid values, or sys.maxint."""
If a Source is iterable, it should never have an (effectively) infinite length, should it? If this is a way of saying "I'm iterable, but I don't want to tell you how long I am" (such as iterating over the results from a database query where you would have to suck them into RAM or issue the query twice to know), shouldn't an exeption be raised? Otherwise 'for i in range(0,len(source)): foo = source[i]' could start blowing up if the source changes. -- Stuart Bishop <[EMAIL PROTECTED]> http://www.stuartbishop.net/
Description: OpenPGP digital signature
_______________________________________________ Zope3-dev mailing list Zope3email@example.com Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com