Can one use Python to learn and even apply Functional Programming?
tjreedy at udel.edu
Sun Feb 16 09:40:24 CET 2014
On 2/16/2014 1:38 AM, Devin Jeanpierre wrote:
> On Sat, Feb 15, 2014 at 8:45 PM, Sam <lightaiyee at gmail.com> wrote:
>> I would like to learn and try out functional programming (FP). I love Python and would like to use it to try FP. Some have advised me to use Haskell instead because Python is not a good language for FP. I am sort of confused at the moment. Is Python a dysfunctional programming language to apply FP? Can the more experienced Python users advise?
> Everything about FP that can be done in, say, Scheme, can be done in
> Python, with the exception of tail recursion (but that isn't important
You can do tail recursion in Python, but it will not be noticed and
optimized in the way it is is some functional languages.
> for "real" FP). But Scheme is old, and people keep thinking of new
> things and more interesting variations on the lambda calculus.
> Haskell is kind of the core of modern functional programming, and
> involves heavy use of concepts that do not exist or are visibly alien
> in Python. If you want to learn FP properly, you should learn Haskell.
> Otherwise you will likely be confused when you overhear functional
> programmers talking, whether it's about Hindley-Milner or sum types or
> eta conversion.
In some ways, Haskell is more different from Python than Scheme is, so
it may stretch your brain more.
Terry Jan Reedy
More information about the Python-list