Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Default arguments in Python - the return - running out of ideas but...
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
CTO  
View profile  
 More options May 13 2009, 3:18 pm
From: CTO <debat...@gmail.com>
Date: Wed, 13 May 2009 12:18:37 -0700 (PDT)
Local: Wed, May 13 2009 3:18 pm
Subject: Re: [Python-ideas] Default arguments in Python - the return - running out of ideas but...
On May 12, 3:56 pm, Pascal Chambon <chambon.pas...@wanadoo.fr> wrote:

> 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

I'm not a fan. If you thought not reevaluating function expressions
was confusing for newbies, wait until you see what making up a new
kind of yield will do for them.

Why not just push for some decorators that do this to be included in
stdlib? I see the utility, but not the point of adding extra syntax.

>>> @Runtime

... def f(x=a**2+2b+c):
...    return x
...
>>> a = 1
>>> b = 2
>>> c = 3
>>> f()

8

This seems much more intuitive and useful to me than adding new
meanings to yield.

Geremy Condra
_______________________________________________
Python-ideas mailing list
Python-id...@python.org
http://mail.python.org/mailman/listinfo/python-ideas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.