Functional Programming in Python

Neel Krishnaswami neelk at brick.cswv.com
Mon Aug 7 21:11:37 EDT 2000


Ted Goranson <tedg at sirius-beta.com> wrote:
> 
> Is anyone doing any functional programming in Python? I understand
> there was quite a push to add lamdba capabilities some years back. I
> know the Norvig paper on Python and Lisp, but that's beside the
> point.
 
Yes, but with the most popular current implementations it's not a
great idea. Basically, the problem is that there is no tail-recursion
elimination, and C/J Python are not lexically scoped, which together
make writing higher-order functions annoyingly painful.

If you want to continue anyway, then I'd recommend taking a look at
Jon Max Skaller's Vyper, which is a Python-derivative (written in
OCaml!) that is more friendly to fp. It adds tail calls, list
comprehensions, lexical scoping, full gc, and pattern matching to
Python. It's still rather experimental, though. See:

  http://vyper.sourceforge.net


Neel



More information about the Python-list mailing list