News for hackers. Stuff that matters.
Re:Reasons Python Sucks by pdonis on Saturday January 14, 2023 @07:43PM (#34385604)
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.

Re:Reasons Python Sucks by Aeolun on Saturday January 14, 2023 @07:52PM (#34385652)
> 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.

Re:Reasons Python Sucks by pdonis on Saturday January 14, 2023 @07:55PM (#34385675)
> 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.

Re:Reasons Python Sucks by Redoubts on Saturday January 14, 2023 @07:54PM (#34385666)
Do 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.
Re:Reasons Python Sucks by marcinzm on Saturday January 14, 2023 @07:57PM (#34385683)
As another comment notes, isn’t this how every popular language except Go, C and C++ functions?
Re:Reasons Python Sucks by mixmastamyk on Saturday January 14, 2023 @07:57PM (#34385689)
It'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.
Re:Reasons Python Sucks by FearlessNebula on Saturday January 14, 2023 @07:57PM (#34385690)
Even 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.
Re:Reasons Python Sucks by glandium on Sunday January 15, 2023 @12:21AM (#34386942)
Recent 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.
Re:Reasons Python Sucks by pdonis on Sunday January 15, 2023 @01:04AM (#34387129)
> 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.

Re:Reasons Python Sucks by erik_seaberg on Sunday January 15, 2023 @01:32AM (#34387237)
3.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.
Re:Reasons Python Sucks by okasaki on Sunday January 15, 2023 @01:40AM (#34387272)
Does Python claim to follow semver? If not then I'm not sure what your point is.
Re:Reasons Python Sucks by erik_seaberg on Sunday January 15, 2023 @02:07AM (#34387372)
From 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 as potentially a major rather than minor release. I wish they had labeled it 311.0 to communicate this and set expectations.
Re:Reasons Python Sucks by pdonis on Sunday January 15, 2023 @05:11PM (#34394137)
PEP 006 describes the way Python versioning has worked since Python was first released. Yes, it's technically not quite the same as current semver, but current semver didn't exist anyway back then.
Re:Reasons Python Sucks by acdha on Sunday January 15, 2023 @02:58PM (#34392684)
That's a decade to make a 30 second change. Add something like https://github.com/asottile/pyupgrade to your pre-commit hooks and you won't even need 25 of those seconds.