4 ms·
Python is valuable due to the ecosystem of libraries it offers. The language itself is extremely poor. I think this is not something most Python users are aware
by lambda_garden 3y ago
Python is valuable due to the ecosystem of libraries it offers. The language itself is extremely poor. I think this is not something most Python users are aware of since if you are doing ML, data-science or simple scripting there is little reason to step outside of the ecosystem.
- Weird scoping rules
- Very limited list-comprehensions
- Ability to monkey patch things is a liability
- Mutability by default
- Lack of support for functional programming
- Deployment story remains extremely painful
- Tacked on type-system
- Slow execution of pure Python code
If this sounds like a rant... it sort of is. I find it really sad that so much programmer effort is being put into something with poor fundamentals. Many of these issues cannot be fixed with breaking changes.
- alsodumb 3y agoI mean it's not like MATLAB where a company put in millions of dollars to make these libraries - the entire ecosystem was developed by open source contributors because they liked something about Python - sure, it's probably not as sophisticated as some of the other languages, but it has a low barrier of entry, it has users, and people developed libraries - in some cases because that's where users are and in many cases because it's the language they know! You're thinking about the programmer effort put into making certain libraries efficient, but think about the users who are reaping the benefits of low barrier to entry! More people are coding, getting comfortable with the idea of programming, and we should welcome them!
- lambda_garden 3y ago> they liked something about Python I think it's simply what they already knew. Very few programmers learn multiple languages to any kind of depth. Is there any evidence that Python is an easy language to learn? I think we've reached a situation where beginners learn Python because it's seen as beginner friendly... because beginners learn Python!
- EnergyAmy 3y agoIt's definitely easier than many other languages to start learning. Absolute beginners don't want to worry about overflow, signedness, or anything like that. They just want to add some numbers and have it work. Python isn't perfect by any stretch, but having syntax like "for x in y:" goes a long way towards helping beginners not have to care about stuff they're not ready for yet. Admittedly, that's just an opinion. I don't know of any relevant studies, but Python wasn't always the preferred language for beginners, and it changed at some point. It feels like there must be a reason for that.
- grumpyprole 3y agoI once read that "Python" came from Monty Python's Flying Circus. And that's how I've always viewed the language, i.e. something akin to a Terry Gilliam animation.
- somat 3y agoPython always felt well designed to me. Slow yes but it felt the the author really thought about how the language would go together. This is mainly a comparison to the other scripting languages available. Pick your poison shell #expand all the strings, but those pipes are nice, why can't more languages have pipes. awk #not a bad language, but very very small, and an AWKward(see what I did there) implied data loop perl #can do anything but the syntax is, well it is a real frankenstein monster of a syntax python #well designed syntax, has a strange block structure but at least it is always nicely formatted tcl #all the strings! but other than that not half bad ruby #pretty, but wow, that is a lot of magic php #just graft on whatever to the language as you need it, don't worry about how it all fits together.
- grumpyprole 3y agoYes it's certainly better, but it definitely slithered out from under the same rock. There are even better languages, designed by folks whose minds where presumably never corrupted by anything on that list.
- whalesalad 3y agoI really cannot agree with most of this. Weird scoping rules? This will rarely if-ever impact you in the real world. The list comprehensions in Python are incredible, in fact people over-use them all the time in really gnarly ways. Like [x for x in [y for y in [z... and the consistency with the same system supporting all datastructures (sets, dictionaries, tuples, etc) is very intuitive. Monkey patching is a liability? This is like saying a car is a liability because I am free to drive it off a cliff. You're technically correct, but you are the one in the drivers seat. The ecosystem does not do or encourage this behavior, with the exception of things like gevent where it is required. Mutability by default is common in virtually every language. You can't say it is good or bad, it's just a fact of life. There is a cost to immutable datastructures unless the language is designed from the get-go to utilize them efficiently. Lack of support for functional programming? Functions are first class in Python. You can pass them around all over the place, as args, put them in datastructures, etc. When you combine this with comprehensions and generators it is very powerful and lets you do lazy evaluation of complex transformations. There are lots of built-in tools in the stdlib to do functional programming. This is just straight up false. Deployment story remains extremely painful - again false, I do not know why people say stuff like this. Create a virtualenv (built into the standard library), and pip install your requirements. If you are using conda and all the other noise you are going to have problems. Slow execution of pure python code - this is the ONLY area where you are perhaps correct... but compared to what? For a lot of use cases, the speed of Python is not a problem. When it becomes a problem, you off-load that responsibility to something else. There is also something to be said for writing software quickly, which is a perk of Python for sure.
- tyree731 3y ago> Slow execution of pure python code - this is the ONLY area where you are perhaps correct... but compared to what? Compared to… basically everything? Python’s performance is unacceptable, especially given that single threaded processor performance isn’t really improving any longer.
- whalesalad 3y agoasyncio is quite fast, especially with libuv/uvloop - https://github.com/libuv/libuv https://github.com/libuv/libuv - https://github.com/MagicStack/uvloop https://github.com/MagicStack/uvloop
- chpmrc 3y agoI could address each of these "issues" but I'd rather focus on the following: > The language itself is extremely poor > I think this is not something most Python users are aware of These two statements are contradictory. If it was indeed so "poor", people would notice :) If they instead increasingly adopt it (out of appreciation, not because they are lobbied into doing it) it becomes really difficult to logically demonstrate that it's a poor choice. Software development is a very efficient market. Everyone is (or can be) aware of (almost) everything. So if most people (including experienced devs) gravitate towards a certain technology, the only acceptable explanation is that the technology, as a whole, is good. Deconstructing and pointing out the flaws of the individual components is a common flawed thought process IMHO. Python is great despite all the issues you point out. To me this is equivalent to comparing individual components when shopping for a product, missing the fact that it's the ensemble of all those (flawed) components that make the product (or the language, in this case) work. The easy syntax, the packages, the community, those are all things that make "weird scoping rules" pretty much irrelevant.
- lambda_garden 3y ago> These two statements are contradictory. If it was indeed so "poor", people would notice :) Would they? The history of programming is full of great ideas that took a very long time to reach mainstream adoption. We also did some things that in hindsight were bad ideas, but for a time were very popular. This is because the programming language "market" is not rational. It moves at the speed of education, not the speed of innovation. People learn a language and they make useful things with it. Why would they stray into niche languages and PL research?
- chpmrc 3y agoI don't claim that Python is the perfect language and it will never be replaced, in popularity, by something that is better. What I'm saying is that considering Python a bad language, just because there are some languages that improve on some of its shortcomings, is just wrong. As of today, Python is the most popular, hence (as a corollary) the best choice for most people. One day that might change, sure. These aren't mutually exclusive. I don't agree with the claim about the market not being "rational". Someone who adopts Python even when given requirements that are clearly beyond the language's capabilities isn't going to last long in such market (and neither will their choices). On the other hand there are plenty of people (myself included) who prefer using Python whenever possible, even though they have been "educated" in the use of other languages (I'd say I'm fairly comfortable with Typescript or even C building non trivial systems). I guess I'm not innovative enough :)