Hacker News new | ask | show | jobs
by knlje 3133 days ago
I'm a researcher and have used exclusively Python 2.7 and NumPy for many years. Originally I ported my codebase from Matlab to NumPy because I wanted to go open source. But it's a very nice thing in science if your code runs perfectly for many years. You don't want to do rewrites. So I feel like I should have stayed with Matlab.

Now that I'm soon forced to do another rewrite, I think I'll just switch to a different language with better future prospects on backwards compatibility. I don't feel that I can trust Python anymore in such things. Any ideas?

6 comments

Matlab has changed far more over the years than Python (e.g. case sensitivity).

Switching from Python 2 to 3 is not a rewrite in the slightest - very little needs to change. Python 3 has many additional features which don't affect existing code (e.g. a matrix multiplication operator, type annotations, underscores as separators in numeric literals, etc.).

No language can improve without changing, and programs can't take advantage of improvements without changing. You are free to use old versions of Python and Numpy forever: languages with perfect backwards compatibility only have it because they're no longer improving.

It is a bit weird to want better support. Version 3 is out for so many years already.

Have you dropped using windows when XP is not supported anymore ?

Not a great analogy: Programs designed for Windows XP, or even as far back as Windows 95, still run on current versions of Windows. Support for 16-bit programs (from the era of Windows 3.0, released in 1990) started to be dropped in Windows 7 64-bit, and even that included "Windows XP Mode" so they could still be run.
MATLAB actually had a lot of changes over they years that broke working code (e.g. changing the order of function arguments and outputs). It is by no means more stable than Python (2 or 3).
The whole Python drama is ridiculous.

When ruby broke all applications when changed from 1.8 to 1.9 (note that it also was a minor version change) no one complained, they just fixed their language and moved on.

I think Python spoiled developers.

There would be less issues if it would never released 2.7 (that version almost exclusively was backporting 3.x features - until 2015 people were asking what features 3 would give that 2.7 didn't have) and just deprecate 2.6 after a year or so like everyone else does.

I think it's a bit hyperbolic to compare rewriting your code from Python 2 to Python 3 to rewriting your code from Language A to Language B, when the former will likely only require changing a few print statements and other minor things. Have you tried running your current code in Python 3 and got a feel for the extent of what would need to be changed?
I don't see why you would need too? Just lock your dependencies and be happy.
What rewrite? Switching to python3 is a quick (almost entirely automated) process. It's really not a big problem.