r/programminghorror • • Jan 12 '22

Python environment

https://imgs.xkcd.com/comics/python_environment.png

[removed] — view removed post

1.4k Upvotes

101 comments sorted by

View all comments

Show parent comments

79

u/mortecouille Jan 12 '22

It got to this mostly because they made the terrible, terrible decision to make python 3 not backwards-compatible. Python 3 came out in 2008 and in 2022, we are now barely seeing the end of python 2, which was officially EOL in 2020.

In comparison, that is only 2 years after java 6, which has now been basically defunct for years already. Not that it's a problem, because if you do have old java 6 code, you can still compile and run it with any subsequent java version. This means that people can painlessly upgrade: if you depend on a library that is not using java (say) 8, your java 8 program can depend on it without issues. This was not true for python. As a result, if you wanted to write something using an existing library, you were bound by the willingness of that library to upgrade to python 3. To this day, there are still old libraries out there that have not been ported to python 3.

The maintainers made the mistake of believing every python developer was equally invested in the language as they are, and assumed people would jump to upgrade their projects to python3. Unsurprisingly, this did not happen.

0

u/DoctorCIS Jan 12 '22

I'm still confused about the decision to make division not backwards-compatible and not the same as most other programming languages.

A friend explained that it made it more logically consistent with other behaviors, but it just seemed so odd to make basic math not backwards compatible.

7

u/ColdPorridge Jan 12 '22

If you mean changing the default division interpretation from integer to float, it was the right call. Python 2 division requires special knowledge of how the language works (e.g. oh you wanted the actual result of this division? Gotta make sure you do x then) and was a consistent source of bugs. Python 3 provides division consistent with lay and mathematical expectations of division. That alone was worth breaking the language from 2 to 3.

2

u/DoctorCIS Jan 12 '22

Ah, I thought how Python handled negative numbers in integer division was new, the whole "says we are truncating, but actually we are floor, which is only the same for positive numbers," thing.

Turns out that's always how it was, and the not truncating floating makes a lot more sense.

That truly was the right call then.