Suggestions for 2002
phr-n2002a at nightsong.com
Sun Jan 13 04:06:12 CET 2002
"Raymond Hettinger" <othello at javanet.com> writes:
> Suggestion #1: Issue a dubious syntax warning for multiple
> assignments where there are overlaps between the assigned-to
> >>> a = ['cat','dog']
> >>> i = 1
> >>> i, a[i] = 0, 'boo'
> >>> a
> ['boo', 'dog'] # not ['cat','boo'] which was expected
I'd call this an outright Python bug even if it's documented in the
reference manual. What's the justification? From the doc, it appears
that even x,y=y,x only works for fairly subtle reasons. This seems
bogus. It would be better if assigning a sequence made a temporary
sequence of the target values before assigning.
> Suggestion #2: Add new built-in functions: xmap, xfilter, and xzip.
Sure, these sound good. I think it will be a while before all the
consequences of adding generators to Python settle in. This is one of them.
> Suggestion #3: Allow 'yield' with no return value.
I don't understand this so well. Yield is more like a print statement
than like a return statement.
> Add a yield-like keyword 'accept' which suspends execution
> just like 'yield' but creates an object with two methods
> .submit() and .flush() which can take arguments and feed them
> into 'accept'. Flush returns and raises a StopStream exception.
What you're asking for now is coroutines. Tim Peters will probably
have more to say but it may not be feasible given how the
More information about the Python-list