Thursday, December 5, 2002

Functional Python

Daniel Sandler shows how to write objectcurry in Python:

Called with an object and the name of a method, will return a standalone function that can be called at any time (as if it were still connected to its object).

It seems that Python doesn’t have real closures, but I was able to write make-adder using the single-element array technique that’s often used with Java inner classes. I also found Peter Norvig’s Python for Lisp Programmers page, which has some great examples of when Python’s more mainstream syntax is and isn’t a win. Norvig says that “Python can be seen as either a practical (better libraries) version of Scheme, or as a cleaned-up (no $@&%) version of Perl.” Finally, the Xoltar toolkit adds functional programming support to Python.

1 Comment RSS · Twitter


Has anybody seen a lisp vs python comparison.

Leave a Comment