Suggested amendment to PEP 255 (fwd)
Gordon McMillan
gmcm at hypernet.com
Wed Jun 20 17:35:02 EDT 2001
Dr. David Mertz wrote:
>One more non-vote for a new spelling of "generator." Despite
>protestations to the contrary by the timbot, I see the very subtle and
>late-in-the-definition-body use of 'yield' as a train wreck waiting to
>happen. Never mind newbies, I am certain that *I* would stumble over
>the difference between generators and (real) functions all the time.
And I'm pretty sure you're underestimating yourself.
*When* might you stumble over this?
In writing one? No, you have to understand "yield" and the iterator
protocol before you write one, and spelling it "generator" neither helps
nor hinders in that.
In figuring out what's going on in a traceback? Not for long (and not
likely more than once), because the traceback will already tell you that
you're in the next method of an iterator, not in a "plain" function call.
In random sampling of code, looking for interesting functions to call? I
just did that on the standard lib, and came up with:
copy_reg.pickle_complex
imaplib.IMAP4._get_response
random.weibullvariate
my-toolbox-is-immeasurably-enriched-<wink>-ly y'rs
- Gordon
More information about the Python-list
mailing list