Please comment on PEP XXX: Enhanced Generators

Raymond Hettinger othello at javanet.com
Thu Jan 31 08:53:15 CET 2002


I have updated the draft PEP summarizing proposed enhancements to
generators:
http://users.javanet.com/~othello/download/genpep.htm

The draft reflects all the comments I've received yesterday when the first
draft was posted.  The major changes since yesterday are listed below.  I
thank everyone for taking time to read the proposal and make thoughtful
comments which resulted in a dramatically improved proposal.  It now has a
much better chance of succeeding.

Please post your comments on the new draft here on comp.lang.py or email
them directly to me.

I have sent a text version to the PEP editor and requested that a number be
assigned.

Thank you,


Raymond Hettinger
othello at javanet.com


Changes:
----------

At the suggestion of Skip Montanaro, the xfilter() code was revised to not
use lambda.

At the suggestion of Alex Martelli, Rocco Moretti, and Kragen Sitaker, the
xmap() code was modelled after that in the Python Cookbook.  The result
exactly mimics the map() function.

At the suggestion of  Kragen Sitaker, the arguments for xmap(), xzip(), and
indexed() are now called collections rather than sequences.

Addressed Pete Shinner's idea about making the argument to yield optional.
At Kragen Sitaker's suggestion, the response to Pete Shinner was toned down
and made value neautral.

Addressed Alex Martelli's question about why .submit() was used instead of
overloading .next()

At Jonathan Hogg's suggestion index() was renamed to indexed().

Several reviewers did not like the use of sys.maxint for infinity, so
indexed() was revised to have its own internal counter and ints() was
eliminated from the proposal.

Kragen Sitaker noticed at typo in the generator comprehension example.  This
was fixed.

Michael Chermside's question and comments on two-way generator communication
was answered directly.

Dr. David Mertz kindly allowed his draft Charming Python column to be
included by reference.

Terry Reedy corrected in error in the discussion of consumers and producers.

Kragen Sitaker raised concerns about the scoping assymmetry between
generator comprehensions and list comprehensions.  I am working a way to
eliminate the assymmetry by replacing the generator's dictionary with the
dictionary of the enclosing scope.

Separated the .throw() idea in to separate section of the proposal because
it can be accepted or rejected independently of the other proposals.  Moving
it out also clarified the discussion of .submit()

Answered a reviewer question about way a separate keyword, 'accept' was not
introduced.

Revised and simplified the discussion of the distinction between .submit()
and .next()










More information about the Python-list mailing list