"Steven Bethard" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Probably you want to catch a TypeError instead of an AttributeError; 
> objects may support the iterator protocol without defining an __iter__ 
> method:

No, having an __iter__ method that returns an iterator is an essential half 
of the current iterator protocol just so that iter(iterator) (== 
iterator.__iter__()) always works.  This requirement conveniently makes 
'iterator' a subcategory of 'iterable'.  (I am ignoing the old and obsolete 
getnext protocol, as does the itertools library module.)

Terry J. Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to