[Python-ideas] Extended "break" "continue" in "for ... in" block.

Simon Sapin simon.sapin at kozea.fr
Thu May 24 13:05:15 CEST 2012


Le 24/05/2012 12:47, 海韵 a écrit :
> we can say there is a generator ("__g = iter(<container>)")
> [...]
> "continue <test>" is equiv to "__g.send(<test>)".

Hi,

iter() returns an iterator, not a generator.
All generators are iterators, but not all iterators are generators: an 
iterator may not have a .send() method.

How would "continue something_that_is_not_None" behave with an iterator 
without a .send() method?

Regards,
-- 
Simon Sapin



More information about the Python-ideas mailing list