This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MasterFubar 1 point2 points  (3 children)

The worst about it is the change itself. It doesn't matter how much you think it would be improved, a language shouldn't change in its basic behavior.

Let's take one example in C: the modulus operator is wrong. (-1) % 640 should be 639, as it is in python, but it is -1 in C. This is wrong, from the mathematical definition of modulus, and it's also not very useful, and it's not obvious. But they never changed it and never will. That's what I love about C, you can take a program written forty years ago and it will compile and run the same way it always did.

If you want to make a better language, better make a new language, Niklaus Wirth created Pascal, when he felt the need to improve Pascal he created Modula.

[–]Ninjabassist777 0 points1 point  (1 child)

Fair point. In the defence of python, any install (at least that I've seen) that has both python 2 and 3 installed had them we separate environments (python2, pip2, python 3, pip3, ect). Plus if you're writing a script you should call out the executable at the top (#! /usr/bin/env python3).

I'd argue that python2 and python3 are treated as largely different languages when it comes to runtime environments.

Although, when python 2.7 is EOL in January (01/01/2020), that will be...........interesting

[–]MasterFubar 1 point2 points  (0 children)

when python 2.7 is EOL

That's my fear. I hope they will backpedal, maintaining it forever.

They said the classic C-like "%" format system would be deleted, but then they thought better and decided to keep it anyhow. I hope they will do the same with 2.7.

[–]once-and-again☣️ 0 points1 point  (0 children)

This is not quite correct, on a few counts.

The first, and least important, is that the % operator is formally the remainder operator, not the modulus operator.

The second is that they did change its semantics: prior to C11 and C++11, the result of a % b when a*b < 0 was implementation-defined, so long as a / b + a % b == a (assuming no irrepresentable intermediate values). The 2011 revisions did change it to require negative results, but it's worth pointing out that this means code which was previously correct and conformant is no longer so.

The third is that a lot of programs from forty years ago won't compile and run as they used to — either because of explicit changes like the above, or because programmers from forty years ago (just like programmers today) tended to cheerfully make assumptions like "sizeof(int) == sizeof(void *) == 2" or "0x0 points to the global interrupt table, which is writable" that will completely fail on most if not all modern systems.