Re: PEP 309 (Partial Function Application) Idea

2006-01-16 Thread Ronald Mai
for a new function, named parameter might be a better choise, but for existing function, placeholder would be better, since you don't need to modify the existing code. -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 309 (Partial Function Application) Idea

2006-01-16 Thread Ronald Mai
sorry, should be "existing" -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 309 (Partial Function Application) Idea

2006-01-16 Thread Ronald Mai
for a new function, named parameter might be a better choise, but for existing function, placeholder would be better, since you don't need to modify the exiting code. -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 309 (Partial Function Application) Idea

2006-01-15 Thread Giovanni Bajo
[EMAIL PROTECTED] wrote: > Since python has named parameter(and I assume this PEP would support > it as well), is it really that useful to have these place holder things > ? Probably not so much, you're right. > As when the parameter list gets long, named param should be easier to > read. > > Th

Re: PEP 309 (Partial Function Application) Idea

2006-01-15 Thread bonono
Giovanni Bajo wrote: > Ronald Mai wrote: > > > Here is a reference implementation: > > > > _ = lambda x: x.pop(0) > > > > def partial(func, *args, **keywords): > > def newfunc(*fargs, **fkeywords): > > newkeywords = keywords.copy() > > newkeywords.update(fkeywords)

Re: PEP 309 (Partial Function Application) Idea

2006-01-15 Thread Giovanni Bajo
Ronald Mai wrote: > Here is a reference implementation: > > _ = lambda x: x.pop(0) > > def partial(func, *args, **keywords): > def newfunc(*fargs, **fkeywords): > newkeywords = keywords.copy() > newkeywords.update(fkeywords) > newargs = (lambda seq: tupl

PEP 309 (Partial Function Application) Idea

2006-01-14 Thread Ronald Mai
In my opinion, Ellipsis might be in the middle, not only in leftmost or rightmost, so a placeholder approach can be much more flexible and convenient. Here is a reference implementation: _ = lambda x: x.pop(0) def partial(func, *args, **keywords): def newfunc(*fargs, **fkeywords):

Re: PEP 309 (Partial Function Application) Idea

2005-03-14 Thread Chris Perkins
Steven Bethard <[EMAIL PROTECTED]> wrote: > > getting attributes with defaults[1]: > objs.sort(key=lambda a: getattr(a, 'lineno', 0)) > objs.sort(key=getattr(__, 'lineno', 0) > Yes, this exact example is one of the (very) few that I found in the standard library where the syntax actual

Re: PEP 309 (Partial Function Application) Idea

2005-03-12 Thread Steven Bethard
Chris Perkins wrote: [snip implementation] While I think that func(x, ...) is more readable than partial(func, x), I'm not sure that I would use either of them often enough to warrant special syntax. Interesting. Thought it might be worth listing a few of the current places people use lambdas (an

Re: PEP 309 (Partial Function Application) Idea

2005-03-12 Thread Chris Perkins
>Scott David Daniels wrote: >>>Chris Perkins wrote: Random idea of the day: How about having syntax support for currying/partial function application, like this: func(..., a, b) func(a, ..., b) func(a, b, ...) That is: 1) Make an Ellipsis literal legal syntax in an

Re: PEP 309 (Partial Function Application) Idea

2005-03-12 Thread Scott David Daniels
Reinhold Birkenfeld wrote: Steven Bethard wrote: Chris Perkins wrote: Random idea of the day: How about having syntax support for currying/partial function application, like this: func(..., a, b) func(a, ..., b) func(a, b, ...) That is: 1) Make an Ellipsis literal legal syntax in an argument list.

Re: PEP 309 (Partial Function Application) Idea

2005-03-11 Thread Reinhold Birkenfeld
Steven Bethard wrote: > Chris Perkins wrote: >> Random idea of the day: How about having syntax support for >> currying/partial function application, like this: >> >> func(..., a, b) >> func(a, ..., b) >> func(a, b, ...) >> >> That is: >> 1) Make an Ellipsis literal legal syntax in an argument li

Re: PEP 309 (Partial Function Application) Idea

2005-03-11 Thread Steven Bethard
Chris Perkins wrote: Random idea of the day: How about having syntax support for currying/partial function application, like this: func(..., a, b) func(a, ..., b) func(a, b, ...) That is: 1) Make an Ellipsis literal legal syntax in an argument list. 2) Have the compiler recognize the Ellipsis liter

PEP 309 (Partial Function Application) Idea

2005-03-11 Thread Chris Perkins
Random idea of the day: How about having syntax support for currying/partial function application, like this: func(..., a, b) func(a, ..., b) func(a, b, ...) That is: 1) Make an Ellipsis literal legal syntax in an argument list. 2) Have the compiler recognize the Ellipsis literal and transform th