Re: Python feature request : operator for function composition

2008-02-04 Thread Kay Schluehr
This won't work for builtin functions. It hardly works for functions and methods defined in 3rd party modules and in no way for functions defined in C extensions. It adds boilerplate statically to remove it at runtime. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python feature request : operator for function composition

2008-02-04 Thread Dustan
On Feb 4, 10:11 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > This is nice. Thanks. > * I wouldn't choose '&' as the composing operator as when I read > 'double & square' I think 'take an x, double it & square it' which is > the wrong interpretation (perhaps << instead?). A very good point t

Re: Python feature request : operator for function composition

2008-02-04 Thread Arnaud Delobelle
On Feb 4, 3:00 pm, Dustan <[EMAIL PROTECTED]> wrote: > On Feb 2, 11:09 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > [snip] > > While you're waiting for it to be implemented, you can build your own > version as a decorator. Here's an example written in haste: > > >>> class composer(object): > >

Re: Python feature request : operator for function composition

2008-02-04 Thread Dustan
On Feb 2, 11:09 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: [snip] While you're waiting for it to be implemented, you can build your own version as a decorator. Here's an example written in haste: >>> class composer(object): def __init__(self, *funcs): self.funcs = funcs

Re: Python feature request : operator for function composition

2008-02-03 Thread Kay Schluehr
On Feb 3, 11:34 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Feb 3, 12:09 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > As you know, there is no operator for function composition in Python. > > When you have two functions F and G and want to express the > > composition F o G you have to c

Re: Python feature request : operator for function composition

2008-02-03 Thread George Sakkis
On Feb 3, 12:09 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > As you know, there is no operator for function composition in Python. > When you have two functions F and G and want to express the > composition F o G you have to create a new closure > > lambda *args, **kwd: F (G (*args, **kwd)) > >

Re: Python feature request : operator for function composition

2008-02-03 Thread Kay Schluehr
On 3 Feb., 10:55, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Feb 3, 9:43 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > > On 3 Feb., 10:13, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > > > On Feb 3, 5:09 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > > As you know, there is no op

Re: Python feature request : operator for function composition

2008-02-03 Thread Arnaud Delobelle
On Feb 3, 9:43 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 3 Feb., 10:13, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > > > > On Feb 3, 5:09 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > As you know, there is no operator for function composition in Python. > > > When you have two funct

Re: Python feature request : operator for function composition

2008-02-03 Thread Kay Schluehr
On 3 Feb., 10:13, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Feb 3, 5:09 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > > As you know, there is no operator for function composition in Python. > > When you have two functions F and G and want to express the > > composition F o G you have

Re: Python feature request : operator for function composition

2008-02-03 Thread Arnaud Delobelle
On Feb 3, 5:09 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > As you know, there is no operator for function composition in Python. > When you have two functions F and G and  want to express the > composition F o G you have to create a new closure > > lambda *args, **kwd: F (G (*args, **kwd)) > > or

Python feature request : operator for function composition

2008-02-02 Thread Kay Schluehr
As you know, there is no operator for function composition in Python. When you have two functions F and G and want to express the composition F o G you have to create a new closure lambda *args, **kwd: F (G (*args, **kwd)) or you write a composition in functional style compose( F, G ) None of