[Python-ideas] Propagating StopIteration value

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Oct 10 01:14:33 CEST 2012


Serhiy Storchaka wrote:
> Is a generator expression work with the iterator protocol or the 
> generator protocol?

Iterator protocol, I think. There is no way to explicitly
return a value from a generator expression, and I don't
think it should implicitly return one either.

Keep in mind that there can be more than one iterable
involved in a genexp, so it's not clear what the return
value should be in general.

-- 
Greg



More information about the Python-ideas mailing list