From: Bruce Leban <br...@leapyear.org>
Date: Wed, 13 May 2009 19:41:17 -0700
Local: Wed, May 13 2009 10:41 pm
Subject: Re: [Python-ideas] Default arguments in Python - the return - running out of ideas but...
On Wed, May 13, 2009 at 5:10 PM, George Sakkis <george.sak...@gmail.com>wrote: > > Bruce Leban wrote: > > There is a proposal, which I thought was accepted in principle, to make > Then how about putting the * before the parameter ? > def myfunc(a, b, *c = lambda: expression): > It's currently a syntax error, although the fact that "*arg" and def foo(a, b := lambda: bar): and more Subproposal (1): Get rid of the explicit lambda for dynamic arguments. That > def myfunc(a, b, *x=[]): > would be equivalent to what previous proposals would write as > def myfunc(a, b, *x=lambda: []): Subproposal (2): If subproposal (1) is accepted, we could get for free > def myfunc(a, b, *m=(a+b)/2): > would mean > def myfunc(a, b, *m = lambda a,b: (a+b)/2): > with the lambda being passed the values of a and b at runtime. Sure Lisp has let and let* but the proposal here is NOT to provide arbitrary --- Bruce
_______________________________________________ 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.
| ||||||||||||||