Live data from Hacker News

Code that will break in Python 4

astrofrog.github.io

111–120 of 237 posts

Re: Code that will break in Python 4

#111
post #33
post #24

Earlier quoted context omitted.

Unless Python 4 is 100% compatible with Python 3, I hope they wouldn't overload that constant!

Yes, they should make the constant True for both Python 3 and Python 4. If you need to make a finer distinction, use a different package.

Then what was the point of using the PY3 constant?

Re: Code that will break in Python 4

#113

Seems like this is the fault of 'six' for defining PY3 in the first place.

Indeed. You could just have a single method: "isV2()" (or whatever the "Pythonic" way to write that is--I've spent too much time in Java recently).

Needs more subdirectories.

Re: Code that will break in Python 4

#114
post #36

Earlier quoted context omitted.

There is a difference between writing code that might break and code that is guaranteed to break. Badly written version checks are guaranteed to break.

Which is why GetVersionEx() on Windows will always tell you that you are running Windows 8, unless your application has a manifest entry indicating specifically that it is compatible with a higher version. Microsoft thought there were too many broken version checks in the wild, so decided to hobble the version check function as a fix. I can understand why they did it.

Hell, the reason Windows 10 is Windows 10 is because of all the bad version checks looking for "9X"

Re: Code that will break in Python 4

#115

> We don't really know yet what Python 4 will look like, but we can be pretty sure that the transition from Python 3 to Python 4 will be a lot smoother Doesn't compute. You can't say you don't know anything about Python4 and immediately follow up with suggestions on how to program for it. And if you really want to be consistent, at least: if (python2): // python 2 else if (python3): // python 3 else: raise "I have no…

This post summarizes everything that is wrong with python.

Not that there aren't a lot of things _right_ with python...

Re: Code that will break in Python 4

#118

> We don't really know yet what Python 4 will look like, but we can be pretty sure that the transition from Python 3 to Python 4 will be a lot smoother Doesn't compute. You can't say you don't know anything about Python4 and immediately follow up with suggestions on how to program for it. And if you really want to be consistent, at least: if (python2): // python 2 else if (python3): // python 3 else: raise "I have no…

My understanding is that the consensus is that Python 3 was the last time backwards incompatible changes would be made to the language. The author's point is that this makes Python 2 a special case, so you should make the default behaviour the Python 3 behaviour.

Re: Code that will break in Python 4

#119
post #47

They could always take the Microsoft route: Python 4 will be internally versioned as Python 3.1 to avoid this sort of problem.

"Version: Python 3.1 (Python 4.2)"

"Version: Python 3.1 (Python 4.2) ruby 2.1.6p336 (2015-04-13 revision 50298) [x64-mingw32], like 2.7.8 [GCC 4.8.3] on cygwin"

Re: Code that will break in Python 4

#120
post #114

Earlier quoted context omitted.

Which is why GetVersionEx() on Windows will always tell you that you are running Windows 8, unless your application has a manifest entry indicating specifically that it is compatible with a higher version. Microsoft thought there were too many broken version checks in the wild, so decided to hobble the version check function as a fix. I can understand why they did it.

Hell, the reason Windows 10 is Windows 10 is because of all the bad version checks looking for "9X"

Ha! Is that true in a documented fashion or just widely suspected? I had never heard that, but it makes perfect sense.
Post reply on HN