r/Python • • Nov 11 '08

Why the hatred for functional programming?

0 Upvotes

86 comments sorted by

View all comments

5

u/Wiseman1024 Nov 11 '08 edited Nov 11 '08

Okay, I don't think I need to tell why I'm asking this. While Python supports functional programming to a reasonable extent, there's a widespread stubborn hatred of functional programming and anything related to it in the Python community (probably starting with the BDFL), and any proposals for extending Python into something more useful for functional programming (without taking out any of the other ways to use Python, of course, that's the good thing about multi-paradigm languages) is received with ruthless hostility and perceived as an attack against Python.

The Python community is generally a good one (especially compared to others), yet this generalized hatred for functional programming and anything related to it seriously turns me off. While Python is currently my overall favourite programming language (considering the quality of the standard and non-standard libraries, support, and features), I'm currently considering putting my effort and time investments somewhere less hostile to functional programming.

Hostility to functional programming is a form of hostility to abstraction, theoretical correctness and cleanliness. I hope I'm wrong, but this seems like pulling the PHP way. Consistently meeting proposals such as tail call elimination with nothing short of "that's liek difficult to understand d00d ha ha no freaking way" doesn't say much about the health of this community; in fact it looks like something straight out of the average PHP documentation comment.

1

u/ianb Nov 12 '08 edited Nov 12 '08

Python isn't hostile to functional programming. It's just not. Yes, people regularly show up on lang.python or python-dev and complain about functional things. It's called trolling, and reading trolls is not how you learn about a language.

It's the nature of the arguments made that make the Python community seem hostile. For instance, someone will get all hot and bothered about the filter function, based on (incorrect!) rumors that it would be eliminated. They show up, complain about it, make some sweeping generalizations about Python and functional programming. And of course people take the bait, and an argument ensues, and some overzealous people say "Python isn't a functional programming language". Of course this is the internet, and anyone can make sweeping claims about Python on either side of this debate. If you look at the names of these people, you'll find they are just regular joes who follow along on the lists, and sometimes get a little ahead of themselves -- these kinds of claims don't come from core Python developers or from Guido.

There is some hostility to the introduction of Lisp features when they don't fit well. filter is an example of this -- instead the preferred form in the community is a list comprehension, which was a language form taken from Haskell. This is hardly an anti-functional-programming stance. Is it wrong for Python to be a little picky about which functional programming languages to take ideas from?

Other complaints aren't even that clear. Yes, writable outer scopes have only just been added, I wish they were added previously, but writing isn't "functional", so really once again you are asking for Lisp patterns, you aren't asking for functional programming support.

Tail call elimination is another hot topic, but I think it makes no sense for Python -- and maybe if tail call elimination didn't cause problems it might have gone in. But that's not the case.

Also, I've yet to see anyone appreciate what a nice functional feature decorators are. All I see is people complaining about things from Lisp they can't find in Python, and can't be bothered to implement themselves (it's not like they'd be hard!) If you think a little more deeply about what you really want, I think you'll find it in Python. Well, so long as you don't need strict functional programming, which does offer advantages (as in Erlang, where it's at the core of its concurrency) -- Python is a multi-paradigm language and nothing is strict anything, but I think everyone is aware of that.