Extending Python Syntax with @
Peter Hansen
peter at engcorp.com
Thu Mar 11 12:01:57 EST 2004
More information about the Python-list mailing list
Thu Mar 11 12:01:57 EST 2004
- Previous message (by thread): Extending Python Syntax with @
- Next message (by thread): Extending Python Syntax with @
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
David MacQuigg wrote: > 'yield' is a little closer to the intent, but again, to most new users > it probably means something more like 'give way' or 'acquiesce', the > opposite of 'resist'. If you had never seen 'yield' used as it is now > in Python, and your first encounter with generator functions was when > you saw @return, would you not think "Ah yes, a modified return.", and > would that not be closer to reality than whatever you might associate > with the word 'yield'? No! The "give way" meaning is _much_ closer to what is going on than "modified return", in my way of looking at it. Return winds up the call stack and just happens to include a result value. Yield temporarily "gives way" but leaves the stack frame in place, available for resumption at a later time. You could say that the result value is incidental, in the return case, while the permanent transfer of context is the key thing. Just the opposite in the case of yield, and therefore much different from a "modified return". This is all semantics, probably, but I don't believe you can make a strong case that yield is an ill-chosen name. -Peter
- Previous message (by thread): Extending Python Syntax with @
- Next message (by thread): Extending Python Syntax with @
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list