Comments invited: PEP 279 Enhanced Generators
Raymond Hettinger
othello at javanet.com
Fri Feb 1 01:56:17 EST 2002
Your review and comments are invited for PEP 279:
http://python.sourceforge.net/peps/pep-0279.html
In summary, it proposes:
1. Four new built-in functions: xmap, xfilter, xzip, and indexed
2. Generator comprehensions: [yield int(x) for x in floatgen()]
3. Feeding data into a generator using an optional argument to .next()
4. Providing a mechanism to raise exceptions in a generator
This version incorporates all of the critiques I received on earlier
discussion drafts. The key changes from the earliest draft are:
- xmap, xfilter, and xzip now exactly mimic map, filter, and zip
- index() was renamed to indexed()
- ints() is no longer being proposed
- generator comprehensions now exactly mimic list comprehensions
- .next(arg) is used instead of a separate .submit() method
- control flow is now the same whether or not 'x=yield None' is used
- .throw(exception) is now a separate part of the proposal
Raymond Hettinger
More information about the Python-list
mailing list