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
 
Bruce Leban  
View profile  
 More options May 13 2009, 6:33 pm
From: Bruce Leban <br...@leapyear.org>
Date: Wed, 13 May 2009 15:33:48 -0700
Local: Wed, May 13 2009 6:33 pm
Subject: Re: [Python-ideas] Default arguments in Python - the return - running out of ideas but...

Sure you can do it with a decorator. Although you might want one default to have this behavior and one not to. And putting the * right next to the lambda makes this a bit more explicit to my eye.

--- Bruce

Georg Brandl <g.bra...@gmx.net> wrote:
>Bruce Leban schrieb:
>> Here's what I'd like:

>> def myfunc(a, b, c = *lambda: expression):
>>   stuff

>> The use of the lambda keyword here makes the scope of any variables in
>> the expression clear. The use of the prefix * makes the syntax invalid
>> today, suggests dereferencing and doesn't hide the overhead.

>Why not

>@calldefaults
>def myfunc(a, b, c = lambda: expression):
>    pass

>which should be possible without introducing new syntax.

>Georg

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

_______________________________________________
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.