Hacker News new | ask | show | jobs
by JohnFen 997 days ago
> Sorry but that's nonsense.

I'm not lying. This problem cost me a full weekend earlier this year. I may have misremembered the exact version numbers, though. Perhaps it wasn't between 2 and 3. Is there a Python 4?

The problem is that you can't have one Python interpreter that covers all versions of Python, and Python is very unforgiving about using the wrong interpreter version.

In any case, it was a serious problem that cost me a lot of time and really soured me on Python as an end user. I've not encountered a similar issue with any other language before, so this appears to be uniquely a Python thing.

But I don't know. I'm happy enough to just avoid Python-based anything whenever possible now.

1 comments

There is no Python 4 - and may not ever be.

If you have downloaded Python 2, you must have done it intentionally, it isn't even available from the Python.org website download anymore - and had not been for a long time.

>The problem is that you can't have one Python interpreter that covers all versions of Python, and Python is very unforgiving about using the wrong interpreter version.

Because it doesn't make sense. The language evolves. Nobody is going to stop working on it only because it could break some old code somewhere. The changes from 2 to 3 happened *15 years ago*.

There is no reason to try to compile/run old Python 2 code today - and if you still do need it for some reason, then you need to download the Python 2 version (which are still available, if you need them but one has to look for them). But then you better know what you are doing.

If some old code requires Python 2, any somewhat experienced Python developer will spot that right away (e.g. the use of print statement in Python 2 vs. print() function in Python 3 is a dead giveaway).

>In any case, it was a serious problem that cost me a lot of time and really soured me on Python as an end user. I've not encountered a similar issue with any other language before, so this appears to be uniquely a Python thing.

I don't doubt it has costed you a lot of time but this was a problem entirely of your own doing by not doing your homework.

You would have exactly the same problems if you tried to compile old K&R C code or C++ code from 20 years ago using modern compilers. Or tried to feed modern C# code to a compiler from 10 years ago. Or, God forbid, tried to run some modern Javascript code using old browser - or that old HTML with Flash and what not in a modern browser ...

Python is actually much more lenient in this regard because a major language change has happened only once, 15 years ago, with Python 2 being deprecated for well over a decade. The point releases are all upward compatible with no issues.

I’m with you on Python 2 to 3 being a fine idea and an improvement but…

> You would have exactly the same problems if you tried to compile old K&R C code or C++ code from 20 years ago using modern compilers. Or tried to feed modern C# code to a compiler from 10 years ago.

If you feed 10 year old C# to a modern compiler it will compile it fine. I’d imagine most C and C++ of even 20-year vintage will still compile. The issue is of forward compatibility, not backwards.

No it won't, as it might be using the breaking for change introduced in C# 5, or .NET Framework features not made available on .NET Core.

Likewise C and C++ have had enough breaking changes since 2010.

It depends. Some projects can be retargeted to netstandard2.0/net6(8).0 without any changes at all, some require minor update of dependencies and some other - do face breaking changes in library code because APIs did get deprecated.

With that said, neither IL nor C# itself had any changes breaking forward compatibility (aside from a very early change to foreach recently discussed here).

C# isn't used in isolation without standard library.

Also, "it depends" isn't the same as "If you feed 10 year old C# to a modern compiler it will compile it fine."