3 ms·
Some of the author's "reasons" are bogus: "My code for Python 3.5 won't work with the Python 3.7 installation unless I intentionally port it to 3.7." Sure it
by pdonis 4y ago
Some of the author's "reasons" are bogus:
"My code for Python 3.5 won't work with the Python 3.7 installation unless I intentionally port it to 3.7."
Sure it will, just invoke it using the Python 3.7 interpreter. I have plenty of code originally written with 3.5 that runs just fine under 3.7, 3.8, 3.9, ...
"In Python, you have to work to pass variables by value."
No, you don't. Python actually doesn't pass variables "by reference". It passes object pointers, but you can't "mutate" an object pointer; it will always point to the same object forever.
What this author doesn't seem to get is that in Python, "variables" aren't labels for memory locations; they're namespace bindings. And unless you explicitly use the global or nonlocal keyword, nothing you do with setting variables inside a function will affect the caller's namespace. Which means that, in effect, Python variables are passed "by value" to functions--the function can only work with the object it was passed, it can't mess with the namespace it was passed from.
What does often trip up new Python programmers is that if you pass a mutable object, like a list or a dict, to a function, the function can mutate the object (add items, remove items, change what object a key or an index refers to). But the claim the author is making is much broader than that.
"Calling the same object by different names doesn't change the object, so it is effectively global."
I think this person simply doesn't understand how Python works.
- Aeolun 4y ago> I think this person simply doesn't understand how Python works. To be fair, if Python does something that is so different from all other languages maybe that’s a complaint in itself, even if the original complaint is invalid.
- Redoubts 4y agoDo you think it does? CS is a field with many wild ideas and I don’t think python is that far into the weeds. Definitely not around 2018 when this was written. A lot of it’s big problems are 90s-scripting-language problems.
- deleted 4y ago[deleted]
- pdonis 4y ago> if Python does something that is so different from all other languages maybe that’s a complaint in itself No, it's just a reason not to use Python if you have trouble understanding how it works. That's true of any tool.
- marcinzm 4y agoAs another comment notes, isn’t this how every popular language except Go, C and C++ functions?
- mixmastamyk 4y agoIt's very easy to use day to day, much easier to grok than C pointers for sure, despite being a bit more limited (in a good way). I remember half the CS 101 class dropping the week pointers were introduced. If it's wrong, I don't wanna be right, as they say.
- FearlessNebula 4y agoEven the title, to me, indicates that the article is going to be lousy. Rather than saying “reasons why I don’t like Python”, they present the title as if Python is objectively bad, which obviously isn’t true.
- deleted 4y ago[deleted]
- glandium 4y agoRecent counter example: if you have python code that uses the "U" open mode (e.g. open(file, "rU")), it doesn't work anymore with 3.11. Yes, it produced a deprecation warning for a few versions, but no, your script that works in python 3.x is not guaranteed to work in 3.y. There are plenty of other examples.
- pdonis 4y ago> it produced a deprecation warning for a few versions Eight, to be exact: 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10. Python 3.3 was released more than 10 years ago. That's a long time for a feature to be deprecated before being removed altogether. > your script that works in python 3.x is not guaranteed to work in 3.y True, not "guaranteed" in every single respect. But spotting and fixing a deprecation warning is pretty simple. So are fixes for other examples of feature removals (and I don't think there are that many in Python 3). That's nothing like the picture the author was painting; he was talking as if code needs to be "ported" between each version, which is just nonsense.
- erik_seaberg 4y ago3.0 or 4.0 is the time to drop a user-facing feature. If 3.11 is not backward compatible, they aren’t following semver. I won’t assume every minor version bump must break stuff, but I have to be aware that it might and budget time for fixes.
- okasaki 4y agoDoes Python claim to follow semver? If not then I'm not sure what your point is.
- erik_seaberg 4y agoFrom https://peps.python.org/pep-0006/ https://peps.python.org/pep-0006/ it seems that 3.10.9 is expected to be compatible with 3.10.8, but users need to treat 3.11.0 like a potentially major rather than minor release. I wish they had labeled it 311.0 to communicate this and set expectations.