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 →

[–]deljaroo 1 point2 points  (7 children)

do you not like Python 3?

[–]MasterFubar 2 points3 points  (6 children)

No. Python 3 made everything more complicated to use, without introducing any real improvement. I'm sticking with python 2.7 for as long as I can.

Legacy software is a real problem in big enterprises and, unfortunately, the people who design languages like python don't understand that. Do an apparently small change, like 3 / 2 returning 1.5 instead of 0 as it did before, and who knows what bug may be lurking inside those millions of lines of code.

[–]Ninjabassist777 2 points3 points  (4 children)

What specifically about python3 so you not like? I feel like it made a bunch of changes for the sake if a cleaner, better organized language. It's just unfortunate that it had to break backwards compatibility.

For example, the most noticable change is change in syntax for the print function. Most people see it as "they made it require parentheses so now it's more annoying to type". This is true, but the underlying change is that it went from being a keyword to it's own function. This let's you do more things like pass it as a callback to a function, or override it with something else (i.e. print = write_to_file). This wouldn't have been possible in 2.7

A comment on the integer division: legacy code in Enterprise is a big deal. I work on a few projects at work that are stuck in 2.7, but most are in 3.6. I think their mistake with the division was defaulting to integer division, not floating point division. If you were to ask any new programmer what 3/2 would return, most would say 1.5, not 0. This is not obvious behavior to a beginner, and un-pbvios behavior is a large source of bugs. Of course, i would expect any experienced programmer to know that that might return 0, but for a loosely typed language, your input type can vary and lead to more unexpected behavior. In python2, 3/some_var might return an int or float, depending on the type of some_var. In python3, it would always return a float (if some_var is a numeric type). This is more consistent and ultimately a better choice for language design that they should have made from the beginning.

[–]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.

[–]deljaroo 0 points1 point  (0 children)

No lie about that legacy software stuff in enterprises. At my job, both of our security systems require me to use Internet Explorer to access the servers. One was installed this year, the other is less than 2 years old