[Python-ideas] Default arguments in Python - the return - running out of ideas but...

Pascal Chambon chambon.pascal at wanadoo.fr
Tue May 12 21:56:28 CEST 2009


Well, since adding new keywords or operators is very sensitive, and the 
existing ones are rather exhausted, it won't be handy to propose a new 
syntax...

One last idea I might have : what about something like

*    def myfunc(a, b, c = yield []):
              pass*

I'm not expert in english, but I'd say the following "equivalents" of 
yield (dixit WordWeb) are in a rather good semantic area :
*Be the cause or source of
*Give or supply
*Cause to happen or be responsible for
*Bring in

Of course the behaviour of this yield is not so close from the one we 
know, but there is no interpretation conflict for the parser, and we 
might quickly get used to it :
* yield in default argument => reevaluate the expression each time
* yield in function body => return value and prepare to receive one

How do you people feel about this ?
Regards,
Pascal

PS : I've heard some month ago someone who compared the new high level 
languages as new religions - with the appearance of notions like 
"py-evangelistes" and stuffs - whereas it had (in his opinion) never 
been so for older languages :p
That's imo somehow true (and that's rather a good sign for those 
languages) ; I feel phrases like "pythonic" or perl's "TIMTOWTDI" have 
gained some kind of sacred aura ^^
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090512/f726b7c0/attachment.html>


More information about the Python-ideas mailing list