Dear Tech Blog Writer
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.
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.
« 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
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.
Now that Guido van Rossum has joined Microsoft I'm looking forward to seeing if speed improvements can be made: https://twitter.com/gvanrossum/status/1326932991566700549?la...
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
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.