Is python a functional programming language ?

which language is best for functional programming…

1 Like

Python is not a purely functional language. Partly for pedestrian reasons, that it has a whole lot of things that imperative / OO languages have that FP explicitly eliminates (in order to get other virtues). And partly because “purity” has a specific technical meaning in the context of FP, and Python doesn’t have it.

Personally, I think it’s a perfectly good language for giving a complete novice a taste for a functional style of programming : using higher-order functions, using comprehensions, using generators as lazily evaluated lists etc. It’s more or less equivalent to Javascript in that respect.

However it ISN’T a real functional language and there are many things in proper FP languages that Python doesn’t have and which you’ll need to understand and master to really get good at FP.

For example, you can write recursively in Python. But you need your compiler to optimise tail-recursion in your language to make it a viable substitute for iterative loops in terms of performance. Without this optimisation you’ll just fill up the stack if you try to process any long list.

Similarly, being able to explicitly define functions which create closures is one thing. Having the ability to curry any function into a closure on the fly makes Haskell a very different experience. You think about your functions in very different ways.

Pattern-matching arguments can make code much more concise.

Take a look at this :

  1. http://stackoverflow.com/questions/1017621/why-isnt-python-very-good-for-functional-programming

  2. https://www.quora.com/Is-Python-a-functional-language

Best language for functional programming :

https://www.quora.com/What-are-the-best-languages-for-getting-into-functional-programming-and-why

To sum it up :

  1. Python isn’t very good for functional programming.

  2. Best for functional programming - Haskell, Scheme, F#, Clojure, Scala, OCaml/SML, Erlang, Elixir.

2 Likes

No python isn’t a functional programming language, rather python is object oriented programming language.

In computer science, functional programming is a programming paradigm—a style of building the structure and elements of computer programs—that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data. It is a declarative programming paradigm, which means programming is done with expressions or declarations instead of statements. In functional code, the output value of a function depends only on the arguments that are passed to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) each time. Eliminating side effects, i.e. changes in state that do not depend on the function inputs, can make it much easier to understand and predict the behavior of a program, which is one of the key motivations for the development of functional programming. Prominent programming languages which support functional programming are Common Lisp, Scheme, Clojure, Wolfram Language (also known as Mathematica), Racket, Erlang, OCaml, Haskell and F#.Javascript also supports functional programming.

For More information refer this

1 Like

Python is a fast growing language.In my institute our juniors are having proper classes of python rather than C++,which I was taught.

Rest make use of google to know about functional programming.

Please google.

1 Like

Python is not functional programming language. Neither it is fully object oriented language.