Ruby and Python
Gareth McCaughan
Gareth.McCaughan at pobox.com
Tue Nov 21 21:14:59 EST 2000
Graham Breed wrote:
[I said:]
> > In Python, you can do this.
> >
> > def compose(f,g):
> > def _(x,g=g): return f(g(x))
> > return _
>
> Almost. You can do this:
>
> >>> def compose(f,g):
> ... def temp(x, f=f, g=g):
> ... return f(g(x))
> ... return temp
Oops! I wonder why I forgot to deal with f when I remembered
the corresponding thing in the C version. Ah well, such is
human fallibility.
--
Gareth McCaughan Gareth.McCaughan at pobox.com
sig under construc
More information about the Python-list
mailing list