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.
-- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list