PEP 255: Simple Generators

Paul Prescod paulp at ActiveState.com
Tue Jun 19 14:18:00 EDT 2001


Carsten Geckeler wrote:
> 
>...
> 
> But when I'm browsing through a source it may help me very much if I could
> see at the `def' line if it's a regular function or a generator.

I see this as an important point. It would be redundant to add a
generator modifier to functions but I think that that redundancy would
actually help people. It would help new users to understand that a
generator is a *type of function*, *determined at compile time* and not
a behavior of a function, determined at runtime. It would help even
expert users to spot generators in code. It would help
documentation-generation programs like pydoc to "flag" generators
without massive complexity. It would help all of us ensure that our code
is inline with our intentions. And it doesn't seem like it would hurt
anything.

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook




More information about the Python-list mailing list