I've been using Python since the 2.3 days, and it's great to see it become so popular.
But lately I think the language has grown more complex, new functionality is being added all the time.
I feel this is unfortunate in some ways. It's not so true anymore that "there's one way of doing things, and it's obvious", which was one of the best things about the language IMHO.
My feeling is the language developers should slow down a bit on new features and focus on packaging and speed.
Still, it's a great, flexible language, and I think it will keep on being relevant for a long time.
The packaging/environments story is really just unacceptable to me in the year 2021. Coming from the JS world, Python's is just a total mess. And it can't even really lean on the "Python didn't start out as a language that needed that stuff" angle, because JS was in the same boat, and overcame it.
Maybe it's too late and it would be an XKCD "now there are 15 competing standards" situation at this point. But Python desperately needs an all-in-one, officially-sanctioned, package manager/manifest format/bundler/etc that keeps all dependencies and environment info in the project directory, not in global symlinks that get shuffled around by a global collection of "virtual environments". It needs to get installed automatically alongside Python itself. It needs to be prescribed by the Python Foundation. And it needs to be here yesterday.
As an occasional Python developer this is the thing I dislike most about it. I always end up spending an hour or two figuring out how to get things installed and working right.
To be fair Node also requires some work to be setup correctly but it seems easier.
We've got pip, conda, poetry, etc, all with their different advantages and disadvantages. I think the only thing that could solve the fragmentation problem is an authoritative solution from the Python Foundation itself. Cohesion is what's needed, not more options.
The thing is that a comprehensive Python packaging solution would need to include packaging of C and C++ extensions at least. And that's not simple. In the meantime, Guix is establishing itself as a cross-language package manager wich can define an own distro, or run on top of a POSIX system like Debian, Ubuntu or Arch. And it is rock solid and currently features around 17,000 packages. A new Python packaging solution would have a hard time competing with that.
I believe pip and conda already support native modules. I'm not saying it was easy to get there, but it's a solved problem at this point. The problem that still needs to be solved is project-scoped dependencies vs system-scoped dependencies. Virtual envs are a hacky workaround that causes all sorts of problems. I'm convinced Python has been one of the major drivers of Docker's adoption, because any given module is concerned with the entire system.
I think the biggest drawback is a cultural one: The Python developers and the wider python community do not value backwards compatibility.
This has the consequence that it is easy to write new code, or to maintain short-lived code, like what is typical for a SAAS company or a start-up, but it will become almost impossible to maintain legacy code. And as Python becomes older, more and more of the total of Python code will become legacy code. The focus on writing new code rather than reading and maintaining old code is also very obvious by the befuddling added complexity of the language. Nobody knows all of C++, but I am not sure whether many Python developers know all of Python syntax and PEPs.
And what makes it even worse is that a lot of development in Python initially came from academic science and universities, like Numpy, but actually most scientific code is legacy code, because researchers and most research institutes operate differently from start-ups.
I hope that your career flourishes and you write many attention grabbing pieces which predict, Cassandra-like, the future of our beloved industry.
But whenever that future arrives, I will be there, slinging Python code, because I love this language. These colors don't run. Nobody puts baby in a corner. I love Python and I'm taking this love to the grave... and beyond. I will be programming in Python when I am a soul living in outer space.
Nothing can stop this love, my friend. It is too good, too deep - I've done too many things with it, to be bothered by runtime efficiencies or however it fails in comparison with Haskell or Rust. I respect everyone's right to disengage and learn Rust or whatever but like I said, this is the bus I'm riding out on.
It's a shame to love a language just because you got used to it instead of trying others and comparing features, every time learning something new, broadening your programming paradigm understanding. Maybe if you stay in your domain where Python is a great choice you don't fall back but we are going to be programming for a long time and jobs change and every language has it's sweet spot regarding domain choice. I've been programming for 15 years and every time I try a new language at a job or a project it helps me write every next thing a little bit better.
I get that it's an opinion piece, but IMO the title is a bit of clickbait.
Does Python have its issues? Yes. Is it suitable for everything (the article mentions mobile development)? No. Does that mean it's going to be superseded? No. Those things don't necessarily even mean it should be superseded, and that's a much weaker claim.
This seems lazy. You could write this same article about any language just with different criticisms.
* Performance is not as dire as the author suggests. It’s just not the biggest priority compared to say V8. There’s a good amount of low hanging fruit, and hot paths in high-perf libraries are typically written in C and just instrumented in Python.
* Whitespace syntax is a non-issue to anyone but beginners in their first week of programming.
* Lambdas being not very good syntax most of the time doesn’t affect anything since you never are required to use them. Just create a function or any other Callable.
* Python being dynamically typed is a style choice, not a deficiency. There are trade-offs but “dynamic with statically checked type annotations” whether it’s Hack, Typescript, or Python is insanely productive.
Nothing to really say about mobile. Totally valid and there’s not a whole lot of work being done on getting it there.
Performance in native Python really is bad. Nine out of ten times, you can get away with it by figuring out how to push all the computation into the layer of C that Python rests on, but sometimes you just can't, and then Python becomes essentially unusable.
From my own experience, implementing Needleman-Wunch or k-mer counting is literally >100x slower in Python than Julia or C. Meaning a two-minute task turns into a 3 hour task - at least. At this point you can begin coding in Rust, but it feels bitter to learn Python, get into it, and then realize you've learned an entire programming language just to use it as wrapper for your actual business code.
« Originally, Python was dynamically scoped. This basically means that, to evaluate an expression, a compiler first searches the current block and then successively all the calling functions. »
Python was never dynamically scoped. Before Python 2.2 it had a three-level static scoping system, and nested functions didn't have any access to variables from their parent function's scope.
I started to rebut specific errors in this in more detail and got tired, but this reads like something written by someone who talked to someone knowledgeable a week earlier, took nhad no knowledge of programming, much less python, to contextualize the conversation, and the tried to writre an authoritative article based on fuzzy, fading memory and interpolation. While intoxicated.
It kind of approaches recognizable real issues, but with most of the details misstated on every point. Python can change bindings in outer scope, statement/expression distinctions are common in languages (but Python’s limited anonymous functions make them more acute in that context in Python), contrary to the contrast the article attempts to draw, JavaScript—like Python—was not designed for mobile and Python—like JavaScript—has frameworks that were. The article also jumbles issues related to static typing, compilation, and performance (and given the existence of—incomplete but evolving—static typecheckers and performance-boosting native code compilers for python, also treats them as more fundamental and immutable than they are.)
> Python is slow. Like, really slow. On average, you’ll need about 2–10 times longer to complete a task with Python than with any other language.
This doesn't seem true in my experience.
First off, I'm glad the author phrased it as time "you'll need ... to complete a task," because in many cases that's a more important measure than any benchmark of the code itself. Given some data and a question about the data, I can almost certainly answer the question faster in a Python REPL or notebook than in any language which needs to be compiled. Sure, it might take ten seconds instead of one to do the math, but it takes much more than nine seconds to write a complete program in a standalone editor and compile it and run the output and look at it.
Second, for tasks that are I/O-heavy and not computation-heavy, the fact that Python is interpreted doesn't really matter. If you're making a request to an API that takes 300 ms to respond, it hardly matters if processing the response takes 1 ms or 10.
Finally, as the author mentions, there are several compiled Python extensions like NumPy.
> Python tried to transition to static scoping, but messed it up. Usually, inner scopes — for example functions within functions — would be able to see and change outer scopes. In Python, inner scopes can only see outer scopes, but not change them.
This is not true:
>>> def a():
... result = []
... def f(x):
... result.append(x ** 2)
... for i in range(10):
... f(i)
... return result
...
>>> a()
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
It is ever so slightly more complicated if you want to use the regular assignment operator: you need to write a "nonlocal" statement, which has been around since Python 3.0 (https://www.python.org/dev/peps/pep-3104/), released in 2008.
>>> def a():
... x = 0
... def f():
... nonlocal x
... x = 1
... f()
... return x
...
>>> a()
1
When people talk about Python being slow, it's generally about the CPU-intensive tasks. Image processing, data file parsing and transformation, those kind of things. Sure you can use C library bindings for those but that's kinda cheating.
Another good alternative to look at is OCaml. It's fast (both to develop and run), and provides a solid, elegant language that fixes almost all of Python's issues. A small one: having a lightweight syntax without being whitespace-sensitive. To the OCaml parser, both of these are the same program:
type person = { name : string; age : int }
let greet { name; age } =
Printf.printf "Hello, %s aged %d!\n" name age
--
type person = { name : string; age : int } let greet { name; age } = Printf.printf "Hello, %s aged %d!\n" name age
> But Python wasn’t made with mobile in mind. So even though it might produce passable results for basic tasks, your best bet is to use a language that was created for mobile app development. Some widely used programming frameworks for mobile include React Native, Flutter, Iconic, and Cordova.
JavaScript based platforma are using … a language that was specifically created for mobile app development?
Why compare a language with a platform anyway? Python <-> JavaScript or dart, not react or flutter.
Python can work if they figure out the type system, right now it's just bolted on the core language. Technically it's true for js too but the js/ts integration feels pretty seamless. Js files get autocomplete from ts code, can embed ts in JSDocs and such.
Types in python is very much just documentation and isn't enforced at compile time.
Of course there are people who believe that types don't matter. I guess to them there isn't really any objective criteria to judge a language, just whatever syntax they happen to like
Python is not the fastest choice, but has long been a solid choice for startups because it's easy to get a site up off the ground and functional. At least as of a year ago, Instagram was on its own fork of Django. Throw in Fast API and Pytorch / Tensorflow and there's quite a bit a good Python web service is capable of.
Most likely people go where the money (code used in production) and or the better supported and complete libraries are and the technical details of the language are more or less irrelevant. C++ is not dead yet.
The author understands little to nothing about programming. I'd bet on the law of the straight line over his/her uninformed take.
Python is slow, but PyTorch is fast, GBTs are fast, Cython is fast, Pandas and Numpy are fast (and even faster libraries or even basic joblib code can parallelize these).
Anything that needs to be fast either is or can be made fast--and most compute in data-intensive applications exists inside these optimized libraries anyway.
Python dynamic type system is the reason it's easy to prototype ideas. Dont need to compile or remember if unsigned int or float required. It's the people's language.
The next easiest would be JavaScript.
Python does support type hinting and vscode parses it.
I see there is even a Jit compiler numba out there for performance
But lately I think the language has grown more complex, new functionality is being added all the time.
I feel this is unfortunate in some ways. It's not so true anymore that "there's one way of doing things, and it's obvious", which was one of the best things about the language IMHO.
My feeling is the language developers should slow down a bit on new features and focus on packaging and speed.
Still, it's a great, flexible language, and I think it will keep on being relevant for a long time.