6 ms·
Why Python is not the programming language of the future
- mjw1007 5y ago« 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.
- bluepoint 5y agoMost 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.
- Delk 5y agoI 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.
- omar_kha 5y agoPython 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
- geofft 5y ago> 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/ 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
- ncann 5y agoWhen 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.
- ksaj 5y agoUsing appropriate tools for the job isn't cheating.
- Spivak 5y agoThis 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.
- jakobnissen 5y agoPerformance 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.
- xf1cf 5y agoAgree, after using python for work on research for one of my papers it was wholly insufficient. I ended up writing more Cython than Python to achieve the performance I needed on a mere 100,000 points of data. My performance metrics were similar but I think it was 200-300x slower for me due to all the extra cruft that gets carried around with data structures. That being said I use Python in my professional life without complaint. It’s performant for 99% of that work. I will just never use Python for novel research again unless there are already libraries I can lean on. You’ll find a lot of the big FAANGs using Python have their own implementation of it. Famously Dropbox hired GVR to implement a special performant LLVM based Python.
- nickserv 5y agoI'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.
- brundolf 5y agoThe 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.
- atom_arranger 5y agoAs 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.
- nsonha 5y agoI thought it should be better now? Last I checked people used poetry for this
- 5y ago
- svaha1728 5y agoPython 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?lang=en https://twitter.com/gvanrossum/status/1326932991566700549?la...
- nottorp 5y ago> 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.
- risk000 5y agoDear 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.
- kungito 5y agoIt'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.
- ku-man 5y agoDon't bother, the author is not a software developer but a journalist. All of his his/her written pieces have clickbait titles, e.g.: - Bye-bye Python. Hello Julia! - We’re Facing a Fake Science Crisis, and AI Is Making It Worse - Is AI Coming for Your Job? - The war between web and game developers
- yawaramin 5y agoAnother 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
- dragonwriter 5y agoI 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.)
- xony 5y agoclickbait
- nsonha 5y agoPython 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
- seasily 5y agoThe 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.
- yawaramin 5y ago> Anything that needs to be fast either is or can be made fast It can be made fast how? Typically by writing it in some other language. That's the point.