Re: 2004 example, passing function error

2008-05-13 Thread alex23
On May 14, 11:40 am, globalrev <[EMAIL PROTECTED]> wrote: > so just a mistake on his part? but it looks like he just copied his > shell...has there been a change since 2004 inr egards to how you can > pass functions as arguments to functions?? Adding the value argument (x) to the compose function

Re: 2004 example, passing function error

2008-05-13 Thread Carsten Haese
globalrev wrote: but it looks like he just copied his shell...has there been a change since 2004 inr egards to how you can pass functions as arguments to functions?? It looks like it's copy/pasted from a shell, but it's not. No past or present Python interpreter could produce an interactive s

2004 example, passing function error

2008-05-13 Thread globalrev
http://linuxgazette.net/109/pramode.html >>> >>>def sqr(x): return x*x ... >>>def cube(x): return x*x*x ... >>>sqr >>>a = [sqr, cube] >>>a[0](2) >>>def compose(f, g): return f(g(x)) ... >>>compose(sqr, cube, 2) 64 >>> but i get: >>> compose(sqr, cube, 2) Traceback (most recent call last): F