From: Tobias Nurmiranta Date: 2004-02-26T19:53:07+09:00 Subject: Re: Need examples comparing Ruby to Python On Thu, 26 Feb 2004, Florian Gross wrote: > I think it's either optional parentheses or function object access via name. Yes, I guess the choice in Ruby is quite ok. > Yup, you will have to backport it. I think he just used Ruby to show the > different semantics of the original posters LISP and Python versions. > (The LISP version returns a function which can be called to get the > result and the Python version directly returns the result.) > > Backported it looks like this: > > def compose(f, g, x): # the result version > return f(g(x)) > > def compose_callable(f, g): # the function version > return lambda x: f(g(x)) Yes, I just didn't have the energy to remember the Python syntax :). It's interesting that Python added closures after several years of development, instead of including it from the beginning. In some releases you had to "from __future__ import nested_scopes" to enable it. , Tobias