On Sun, Jun 30, 2013 at 12:11 AM, Terry Reedy <tjre...@udel.edu> wrote: > On 6/30/2013 1:46 AM, Ian Kelly wrote: > >> On a related note, I think that generator functions should in some way >> be explicitly marked as such in the declaration, rather than needing >> to scan the entire function body for a yield statement to determine >> whether it's a generator or not. > > > I agree that one should not have to scan. The doc string, which should be > present should start 'Return a generator that yields ...' or even 'Generate > ...'. Of course, then non-generator functions should not start the same way. > The first option should be non-ambiguous.
I don't deny that properly written comments help, but consider that Python already enforces proper indentation for the sake of readability. I don't think it would be a great harm if the syntax enforced easily readable generator -- http://mail.python.org/mailman/listinfo/python-list