[Python-3000] Builtin iterator type

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Nov 14 05:02:24 CET 2006


George Sakkis <george.sakkis <at> gmail.com> writes:
...
> As for the duck typing, I mentioned already that nobody forces you to
> extend this type to make some class an iterator, as nobody forces you
> to extend dict or dictmixin to write a user-defined mapping. You may
> well start from scratch implementing just next(); if you don't plan to
> use "+", "*" or any of the itertools operations on this type,
> extending Iter is useless. If you do plan to provide these operations
> though, you may either write them from scratch every time, or extend
> Iter.
> 

Unfortunately, an iterator that only defines next() will not be
compatible with the functions that would take advantage of
your proposal.



More information about the Python-3000 mailing list