PEP 322: Reverse Iteration (REVISED, please comment)

Alex Martelli aleax at aleax.it
Wed Oct 29 14:42:24 EST 2003


Peter Otten wrote:

> Raymond Hettinger wrote:
   ,,,
>> iter() is a factory function that can return all kinds of things:

Right, and thus it must stay.  Oh well.

> So why couldn't all these iterators inherit from iter just as unicode and
> str do from basestring?

They might, but then calling iter() should complain that iter is an
abstract baseclass, not instantiable, just like calling basestring()
does.  Having an abstract baseclass that DOES return new objects when
called would be very perverse indeed.  So, making iter a type is not
really a sensible option, alas.


Alex





More information about the Python-list mailing list