by koliber · 9y ago · 0 comments
My main critique is that the author added this statement that puts a negative, entitled, and naive tone on the whole article:
>>> to which no real improvements are being made for some reason. (Incompetence? Politics? Both? Who knows.)
The author is not acknowledging that some of his points were not addressed because of reasons other than incompetence and/or politics. I imagine this statement could offend some of the smart and hard-working people who are working on improving the python language.
Reasons the author does not acknowledge:
- the community does not agree with the author's subjective idea of what Python should look like
- the solutions to a problem (I'm thinking GIL) come with a lot of consequences which are not readily acceptable
- solving some of the issues would exacerbate backwards compatibility. This would increase the author's problems even more, because, as he states "This is particularly a pain for libraries where I expect to pip install them and have them "Just Work"."
Certainly, it is titled "Problems I Have" for a reason. :-) I do not expect everyone to agree with me, but it is what I feel I personally lack when using it quite a lot.
> I imagine this statement could offend some of the smart and hard-working people who are working on improving the python language.
That was certainly not my intention -- as stated, I do love the language and appreciate all work going into it. I do not intend to undermine their efforts, just point out some of my perceived design flaws.
>- the community does not agree with the author's subjective idea of what Python should look like
I think we all agree there should be a good solution to concurrency (and "stackless" variants which power eventlet, etc. have been used for ages; as has Twisted, of which asyncio is not a sufficient clone.), parallelism, etc.
The standard library in general encourages use of higher-order functions and concepts borrowed primarily from FPLs (see: comprehensions, map/reduce, sort, etc.) I could not imagine seeing them backtracking on this -- it only helps them to go further in that direction.
>- the solutions to a problem (I'm thinking GIL) come with a lot of consequences which are not readily acceptable
I did not propose a solution because there are many, as you note; there are, however, implementations with decent solutions like AFAIK Jython.
>- solving some of the issues would exacerbate backwards compatibility.
Such as what?
There are no solutions that satisfy everyone that I am aware of yet. Guido has said in the past that he'd be happy to get rid of the GIL, and would merge a patch that solves it, as long as:
* It does not reduce the performance of single-threaded Python code.
* It stays compatible with all existing pure Python code and C extensions.
But in practice, GIL is not that much of an issue for many types of applications where Python is popular.
* It's not an issue for web apps, because these are typically served from multiple physical servers each running multiple python processes. These do not share a GIL anyway, and "thread safety" is pushed to database transactions.
* It is not an issue for apps which spend most of the time doing I/O. Most IO libraries release the GIL, and other threads can run while you're waiting for results from the database.
* It is not an issue for data science doing heavy number crunching with numpy and everything built on top of numpy. Numpy releases the GIL while doing large computations in C.
* It is not an issue for small scripts, as a "better than Bash".
The GIL is only an issue for apps that do heavy computation in pure Python code, and need parallelism within a single process (socket servers? text data processing?). As a result, many Python users just don't find it a big enough problem to be worth solving, if the solution comes with downsides for their use cases.
This is a common misconception that doesn't seem to be backed up by any data.
Dave Beazley did a number of performance tests with profiling, looking at GIL contention in a multi-core scenario: http://www.dabeaz.com/python/GIL.pdf
The results were that even IO-bound workloads still suffered because of the poor implementation of the GIL (details on slide 35 or so). This was an issue up until Python 3.2 (!) when a new GIL implementation was added, which he also profiled: http://www.dabeaz.com/python/NewGIL.pdf
Multithreaded IO-bound tasks don't care about the GIL.
Yeah the old implementations of the language were not as good as the latest. It doesn't seem right to criticize the language for problems that have already been fixed.
> I did not propose a solution because there are many, as you note; there are, however, implementations with decent solutions like AFAIK Jython.
>>- solving some of the issues would exacerbate backwards compatibility.
> Such as what?
Let's use the GIL for example. The reason that is still present is not that it is hard to remove it. It already was removed in the past. The problem is that when GIL is replaced with smaller locks, the python becomes much slower, because of some features and behavior that people got used to.
One could make python faster by changing behavior, but then it would break existing code and C extensions.
There's no easy way to do this without sacrificing something else. Larry Hastings work on removing GIL and has interesting talk about it[1]
Most people who are ignorant about the subject always assume the GIL is stupid and useless, but the GIL allows Python to be extremely fast in single threaded scenarios, and any attempt to remove it introduces at least 20% slow downs.
And C extension support is also a huge factor as you mention. All of Python's scientific modules would be lost if they broke that.
The author assumes these are simple problems that can be solved but aren't because of politics or incompetence, but some of the smartest mind have attempted and failed.
I'd like the author to try and come up to solutions or at least draft ideas for how each of his points can be fixed. A lot of those are easy to state but difficult to solve without breaking more stuff.
> with decent solutions like AFAIK Jython.
>>- solving some of the issues would exacerbate backwards compatibility. Such as what?
Jython can't load native C extensions which should be GIL aware. Most programs, and the python interpreter itself, aren't thread safe so suddenly removing the GIL would break a lot of programs.I agree with you that the concurrency story for python sucks, but claiming solutions could exist without breaking back-compat is just not right.
Last I used it is had issues keeping pace, i.e. demonstrable memory issue that took a long time to fix, lagged considerably behind python 2/3 versions.
It's also worth noting, that as an essentially transcompiled language, you need to have a good appreciation of Java machinery, in which case languages like Groovy provide good competition.
I mean, you have a good point on C extensions but code relying on them (without a really portable API) is almost never going to be forward compatible anyway. (There are still quite a few C extensions not up to CPython 3 yet.)
Is it really realistic to 'have it all'? I'm fully aware that I'd have to go to crazier languages if I want parallelism or speed. For what Python is, it offers me reasonable tradeoffs (mostly slanted towards productivity)..
Regarding the FP comments, since it lacks TCO, my take away has always been that Python can only ever become a quasi-functional language. Its hard to be more than that in its current state.
Anyways. These questions made me want to ask you - what languages do you think are better in comparison?
I am taken aback by the evangelical tone of Python enthusiasts, where is has warts intentionally maintained by the creator in the form of missing features.
If you want speed you go to any other scripting language (other than Ruby). I agree Python is mostly sane and naiively productive. That being said, it's a result of the syntax. Transpiling it to another language like Google did, shows that the underlying technology is not worth much.
> what languages do you think are better in comparison
Better in what way? PHP, Go, Pony, Javascript all have these features and the problems with the languages are not that people don't understand when they come across a switch or map.
Ruby has historically had the same issues. Most Pythonistas I know aren't so evangelical. It's mostly a question of how to go about integrating C/C++ code.
Many people complaining about the GIL (and the like) have some naive microbenchmark, don't understand the trade-offs/limitations of their runtime etc. That doesn't mean critique isn't important and required, but it's going to be better when it's properly researched and improves on the body of work out there (https://www.youtube.com/watch?v=Obt-vMVdM8s).
> Transpiling it to another language like Google did, shows that the underlying technology is not worth much.
How is this any general indicator of the worth of the language?
It shows for some cases, that Google thought this was a worthwhile investment. Google has experimented for a long time with ways to improve how Python code can be run. They ran the Unladen Swallow project, but spent more time on LLVM issues at the time making it infeasible to continue the project.
They'll discontinue one path and try another. None of this is really a commentary from Google on CPython, the community, or the value that it has for most people. The people working on this stuff interact in a pretty friendly basis.
Which one? PHP? Perl? Bash? Scheme? VBScript? Windows PowerShell?
Python is in fact of the fastest scripting languages that exist, especially JIT'ed.
The notable exception is JS, and oh, that has a GIL too :P
TCE can also make debugging easier, how useful is a stack trace of 1000 lines consisting of
...
File "bla.py", line 4, in fib
return fib(n - 1) + fib(n - 2)
File "bla.py", line 4, in fib
return fib(n - 1) + fib(n - 2)
File "bla.py", line 4, in fib
return fib(n - 1) + fib(n - 2)
...Not so much I think.
People seem to be missing that sentiment -- I do love Python and use it almost daily. This is merely a list of thorns I run into frequently.
>Regarding the FP comments, since it lacks TCO, my take away has always been that Python can only ever become a quasi-functional language. Its hard to be more than that in its current state.
I mean, it could always encourage playing with functions more -- and importantly, providing an stdlib that encourages that.
>These questions made me want to ask you - what languages do you think are better in comparison?
That is a somewhat loaded question: my counter question would be, "In what regards?"
I cannot say a certain language is better than Python in every or most circumstances, but I can in regards to specific points/features, if you'd like to elaborate.
> These are obvious flaws in design, in my opinion, that warrant re-looking at, but to which no real improvements are being made for some reason. (Incompetence? Politics? Both? Who knows.)
You list a number of things which Python ecosystem should do better or differently, and suggest that the reason why these changes aren't getting built as fast as you'd like is people playing politics or incompetence.
Whereas in reality, the two main reasons are that the changes will take lots of effort and time, which the volunteers don't have next to their day jobs (PyPy), or that the developers have different opinions on the ideal language design, and just don't agree with you (heavy functional programming).
"It is my personal subjective opinion that you are incompetent" isn't less harsh than "You are incompetent".
For someone who declares he hates functional programming even at the most basic levels of data stream manipulation, he knows it quite well.
I've always been frustrated with this disconnect, even more acutely than you have, because I know GVR is being disingenuous when he says, "I don't get it." He absolutely does. He thinks other people won't.
It's not what you think it is. It's Python, not a toy language used by nobody. Just first try yourself to "fix" Python and keep its existing users happy by not breaking anything for them, then write about it.
One of the major factors in speed is efficient memory layout. Contrast a Python list with a NumPy array. To achieve speedier loops and vectorized arithmetic [0], the array gives up dynamic typing and dynamic sizing. In most applications, I would gladly give up some compute speed to gain some programming productivity.
I love duck-typing. Formal typing has some impressive examples, but in the projects I've worked on has reduced my productivity. Perhaps because data are so often serialized to simple formats or written to databases that discard the best tools of formal typing. Anecdotal evidence, for sure.
I've never been bothered by the GIL, but I have benefitted from it [1].
Your own article appears to have exactly that claim:
> These are obvious flaws in design, in my opinion, that warrant re-looking at, but to which no real improvements are being made for some reason. (Incompetence? Politics? Both? Who knows.)
> Without further ado: The standard interpreter bring rather slow; PyPy is nice, but its Python 3 support is very immature.
I don't think the standard library really 'encourages' this in a way that's different from most languages that support first class (rather than 'higher order') functions. If you consider python's evolution, its support for many common programming paradigms was somewhat haphazard and weak and developed over time, mostly pragmatically. OO has become stronger, the 80% use case of common functional idioms is covered by comprehensions, etc. Ill thought out features (e.g. terrible lambdas) have become de-emphasised. The choices are extensively document, even if not everyone cup of tea so it seems both glib and inaccurate to say (re: FP) 'it only helps them to go further in that direction'. How does it help them?
TL;DR - One language for all purposes is the wrong focus.
- Python's success is largely due to things it has done well: Numeric and scientific computing (NumPy, SciPy), system administration scripting (yum, RHEL), workflow management (Luigi, Airflow, Snakemake).
- The idea that one language can be used in all tiers leads to things like JavaScript. Does all things but none of them well.
- PHP and Ruby are already strong in the webdev area, and there is little need for Python to compete here. Resources spent on making Python a top tier webdev language will always be a game of catch up, and distract from its strengths.
- Yes Django is a thing, and should continue to evolve, but its unlikely to catch up to PHP.
That boat sailed a long time ago with the introduction of Python 3.
(Ok, Ok my comment is slightly tongue-in-cheek. I agree that backwards compatibility is usually a good idea and should not be broken without a great deal of thought.)
Are not readily acceptable to Guido. Whether that's a good thing (for the language) or not is subjective. At least Guido has a vision and is sticking to it!