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.
Besides lack of support for tail calls, which is the only example you give, what makes you think that python doesn't support functional programming? What proposals do you refer to that have been shot down?
My POV: Python spports FP just fine as long as it doesn't conflict with python itself. Remember that Python has:
list comprehensions
generators
coroutines
filter map and reduce built-in
real first-class functions with closures (albeit those can be a bit quirky)
All of those things point to no fundamental language bias against FP.
Besides tail call elimination, which could be added but and it's not being rejected because it can't be done, but because it's deliberately unwanted, I have:
Guido's stubborn quest to make lambda useless by not accepting statements inside it, or by not making statements expressions. He even wanted to remove it at one point, but he saw it was pressing too hard.
The closures are pretty real, but the way scopes are handled is inconvenient. It could have been fixed in so many numerous ways so long ago, but it was always an nth-priority. The chosen solution, nonlocal, is acceptable but suboptimal. Expanding lambda into a def with better semantics would have been much, much better, and even more backwards-compatible, since it wouldn't require the introduction of a new keyword.
The "flat is better than nested" philosophy is keeping the language from becoming more expressive. In particular, it still has statements. They need to die. I've been talking somewhere else in Reddit about how we could have Python be fully backwards-compatible while turning its current statements (a design wart from the age of Fortran) into expressions. There are countless advantages to that, which is basically lifting a limitation, but I've seen the community even wants an arbitrary limitation to stay just so that you cannot write more flexible code.
filter, map and reduce? You're pointing out a weak spot, not a strong one. First of all, Guido actively discourages their use in most cases, and he's moving reduce out of builtins (he also expressed his dislike of it many times).
More importantly, Python ships with an extensive standard library to handle text in many ways, lots of class utilities, lots of pretty much everything, and almost no FP-related utilities in comparison. The FP utilities have been neglected since ever. Where are promises, futures, foldr, foreach/repeat/other functional loop constructs, scanl/r, flip, prog1, progn, conses, memoizators...?
Guido prefers named functions to unnamed ones; it's his language, how does that affect the functionality of the language?
The scope handling is what I was referring to as a bit quirky. I can see this as a beef with the language, and might even agree somewhat, but I don't see it in the light of opposition to FP that you do.
Again, I cautiously agree while seeing your point as largely orthogonal to your original hostile-to-FP complaint.
Who cares if they're in builtins or functools? Or if Guido prefers spelling filter(lambda x,y: something(x,y), collection) as [something(x,y) for x,y in collection]?
It definitely doesn't ship with an FP toolkit, and the stdlib doesn't return self on some things that are truly maddening. However, I see that as being because Python is not a primarily functional language, and so the builtins need can reflect that.
However, the language also doesn't do anything to prevent you from adding those. If anything, I think the language should be characterized as cautiously tolerant of FP style, with one big exception, tail calls.
(Furthermore, you're making fine rational arguments (in our thread at the least) and people shouldn't be downvoting you. Raise your level, redditors.)
Guido prefers named functions to unnamed ones; it's his language, how does that affect the functionality of the language?
It doesn't affect the functionality outside namespace pollution, but it affects readability. Wasn't readability a goal of Python?
Who cares if they're in builtins or functools?
Not too important (every of my modules does import * from functools on top), but it shows the focus. You asked if there's a fundamental bias against FP and I was replying to that.
However, I see that as being because Python is not a primarily functional language, and so the builtins need can reflect that.
Python is not primarily a language for writing HTTP servers, yet it ships with one in the standard library. Even if it's not the main focus, FP could be given some attention.
(Furthermore, you're making fine rational arguments (in our thread at the least) and people shouldn't be downvoting you. Raise your level, redditors.)
My grandparent post was seen as criticism on Python, so I guess the fanboys will downvote. Since there are more fanboys than people willing to engage in rational discussion, the total score is going to be negative. Same as for the whole Reddit post.
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.