Python syntax in Lisp and Scheme

Grzegorz Chrupala grzegorz at pithekos.net
Sat Oct 4 09:24:11 EDT 2003


bokr at oz.net (Bengt Richter) wrote in message news:<blm34i$l6s$0 at 216.39.172.122>...

> Do you like this better?
> 
>  >>> def foo(n):
>  ...     box = [n]
>  ...     def foo(i): box[0]+=i; return box[0]
>  ...     return foo
>  ...

It's still a hack that shows an area where Python has unnecessary
limitations, isn't it?
As Paul Graham says (<URL:http://www.paulgraham.com/icad.html>):

> Python users might legitimately ask why they can't just write
> 
> def foo(n):
>   return lambda i: return n += i 
> 
>  or even 
> 
> def foo(n):
>   lambda i: n += i
> 

Cheers,
-- Grzegorz




More information about the Python-list mailing list