[Python-ideas] Generators are iterators

Ethan Furman ethan at stoneleaf.us
Fri Dec 12 20:28:49 CET 2014

On 12/12/2014 09:16 AM, Chris Barker wrote:
> 3) there are essentially two (and a half) ways for python code authors to write their own, custom TIIP:
>   1) write a class that has a __iter__ and __next__ methods that "do the right thing"
>   2a) write a generator function
>   2b) write a generator expression

    3) write a class with __getitem__ that supports integer indexing


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20141212/ebd2f9dd/attachment.sig>

More information about the Python-ideas mailing list