yield_all needed in Python

Antoon Pardon apardon at forel.vub.ac.be
Tue Mar 1 07:37:13 EST 2005


Op 2005-03-01, Steve Holden schreef <steve at holdenweb.com>:
> Terry Reedy wrote:
>> "Douglas Alan" <nessus at mit.edu> wrote in message 
>> news:lck6osnu68.fsf at gaffa.mit.edu...
>> 
>>>    We can shorten the code--and make it run in O(N) time--by adding a 
>>>new
>>>    keyword to replace the "for v in ...: yield v" pattern:
>> 
>> 
>> Maybe.  Until you define the semantics of yield_all and at least outline an 
>> implementation, I am not convinced of 'run in o(n) time'.  There was once a 
>> several-post discussion of a related idea of having yield somehow, 
>> magically, skip intermediate generators that only yielded value on up, 
>> without tranformation.  But it was never clear how to do this practically 
>> without negatively impacting all generators.  Cetainly, if <yield_all 
>> iterator> == <for i in iterator: yield i>, I don't see how anything is 
>> gained except for a few keystrokes.  If <yield_all iterator> == <yield 
>> list(i for i in iterator)> then the replacement is a semantic change.
>> 
> La plus ca change, la plus c'est la meme chose (I trust native French 
> speakers will excuse the laziness that led to the absence of accent).


Small diversion:

You weren't lazy enough because you added words. The idiom AFAIK is:

Plus ça change, plus ça reste la même chose.

You shouldn't add the "la", I think that came from translating
too literally, adding an article to a comparative in french
turns it into a superlative. So instead of writing:

  The more it changes, the more is stays the same

You wrote something like:

  Most it changes, most it is the same thing.

-- 
Antoon Pardon



More information about the Python-list mailing list