[Python-ideas] should there be a difference between generators and iterators?

Zaur Shibzoukhov szport at gmail.com
Mon Sep 8 10:47:27 CEST 2008


Bruce Frederiksen wrote:
>Since there is no need to clean up after iterators in general, but only
>for generators specifically; and since the BDFL has nixed my point #5,
>it makes sense to only add the __enter__ and __exit__ to generators.
>(And, by extension, itertools).

It makes more sense to allow extending of builtin types in order to
support different protocols
(not only protocol for "with" statement)



More information about the Python-ideas mailing list