63
u/mmarius90 Jan 16 '19
Progress is achieved similarly to the way the fibonacci sequence is constructed. You build on top of what you previously achieved.
Python 3 is truly an amazing piece of software.
And let's not forget it's predecessors, the community and everybody who contributed. Here's to 10 more!
-11
u/jennylover7 Jan 16 '19
Won't python 3 be replaced in the next three years? 3.8 this year, 3.9 next and then 4.0? How will the python maintainers avoid another shit storm like python2/3?
61
u/doubleunplussed Jan 16 '19
That's not how version numbers generally work. No reason not to have 3.10.0, other than compatibility for code that assumes there is only one digit between the dots. We are on GNOME 3.30.2, Linux 4.20.1, numpy 1.15.4, why not Python 3.10.0?
12
u/james_pic Jan 16 '19
I believe Guido's of the opinion that 3.9 should be followed by 4.0, purely for aesthetic reasons, so it's likely that'll happen. Although the core developers generally agree that if that happens, then 3.9 -> 4.0 will not have major breaking changes, in the way that 2.x -> 3.0 did.
20
Jan 16 '19 edited Jan 16 '19
[removed] — view removed comment
39
u/curiousGambler Jan 16 '19
Thank god. Deciding whether a version bump should be major or minor based on “aesthetic reasons” would be beyond moronic.
14
Jan 16 '19 edited Jan 16 '19
Linus Torvalds would like to have a word with you...
Also, from https://lkml.org/lkml/2019/1/6/178
Subject Linux 5.0-rc1
[...]
The numbering change is not indicative of anything special. If you want to have an official reason, it's that I ran out of fingers and toes to count on, so 4.21 became 5.0. There's no nice git object numerology this time (we're about 6.5M objects in the git repo), and there isn't any major particular feature that made for the release numbering either. Of course, depending on your particular interests, some people might well find a feature they like so much that they think it can do as a reason for incrementing the major number.
So go wild. Make up your own reason for why it's 5.0.
5
u/curiousGambler Jan 16 '19
Lol. Interesting finds, for sure. I stand by my statement but like any good engineer, I’m of two minds on the issue, and another part of me says, “it’s a version string, who gives a shit, as long as they match when they need to” because while my first comment represented the ideal, your comment shows even the most famous projects can be laissez faire about versions and making any assumptions based on them would be equally moronic!
Thanks for those nuggets!
11
Jan 16 '19
Ooohh boy, looks like you're one of today's lucky 10,000!
The Linux kernel is a special case. Usually the difference between major and minor version bumps has to do with backwards compatibility. However, it is the strict policy of the Linux kernel that kernel updates NEVER EVER break backwards compatibility with userspace programs, EVER!! So that scheme doesn't have much merit.
Interesting links:
Linus goes on expletive filled rant when one of his kernel maintainers suggests breaking backwards compatibility
Why is there a Linux kernel policy to never break user space?3
u/dimisdas Jan 17 '19
Holly molly, I wouldn’t want to be on the receiving end of one of his emails.
→ More replies (0)2
2
u/ThreePinkApples Jan 16 '19 edited Jan 16 '19
Hm, interesting. But he has left Python now, hasn't he? Regardless, Python 3.7 doc does mention 4.0 a few times
3
u/Jugad Py3 ftw Jan 16 '19 edited Jan 17 '19
But he's left Python
Nope... he made it clear that he is only giving up the BDFL position. He will still continue to work on Python and give his advise / opinion when requested - but won't be responsible for making BDFL level decisions.
1
1
u/ThreePinkApples Jan 16 '19
The Python 3.7 doc does mention 4.0 a few times, it looks like the current plan is to call 3.10 4.0. But that might of course change. Just make sure you don't do sys.version_info.major == 3 just in case
5
u/Jugad Py3 ftw Jan 16 '19 edited Jan 19 '19
The shit storm was not due to numbering change from 2 to 3.
It was because of breaking backward compatibility.
Maybe the python core thought that developers would be as excited and interested as them (and have the time and resources) in upgrading existing python2 code to the new and improved python 3.
No one upgraded unless they absolutely needed to... and one way to make people upgrade was to make python 3 much better than 2.
3
2
u/david622 Jan 17 '19
Upvoted because the dude is allowed to ask a question without his comment getting buried with a negative vote count
1
u/ThreePinkApples Jan 16 '19
Yes and no. From what I've gathered Python 3.10==4.0. as in, there won't be any real major changes for 4.0, not bigger than previous dot releases. The Python 3.7 doc does mention 4.0 a few times, and that's the only official information I've found, so what I said above might not be correct, or just be the initial intention that might change. But it general, there seems to be no reason to fear a shit storm when 4.0 releases. The biggest problem would probably be code that made the mistake of explicitly checking for 3 and not > 2 or != 2. I went through all of our modules at work when I heard about 4.0 to correct such mistakes.
0
u/flying-sheep Jan 16 '19
By symlinking python3 to python4. It’s not going to be nearly as big changes as the python2→python3 transition.
2
1
u/TheBlackCat13 Jan 17 '19
I think by that point the
pythonexecutable is planned to bed pointing to the latest installed python version.
9
u/aleczorz Jan 16 '19
As someone who is relatively new to Python, should I make the effort to learn Python 2.7 syntax? Or should I stick to Python 3+?
65
18
22
u/cabb99 Jan 16 '19
Stick to python 3. You will be able to import from the future if you really need to code in python 2, but it is usually easy to convert from 2 to 3.
8
u/Jugad Py3 ftw Jan 16 '19
Better to start with 3... and if you ever need to learn it, python 2 has very few differences when compared to 3. So it won't be a big deal if you do need to figure out some python 2 code in the future.
4
1
u/ivosaurus pip'ing it up Jan 17 '19
Learn about Python 2.7 idiosyncracies when you actually run into code that demands to be run on 2 that you have to deal with.
i.e, only cross the Python 2 bridge when you actually come to it.
28
Jan 17 '19
Here’s a challenge: Stop starting new projects in 2.7
6
6
u/flying-sheep Jan 17 '19
Who still does that?
2
Jan 17 '19
I wish I couldn’t answer to that question, but the list is long
2
u/flying-sheep Jan 17 '19
Anything that is of general interest? We should
shamegently encourage that promising stuff is converted to python 3 early.
5
u/Bamaesquire Jan 17 '19
Yet, every 10 seconds, someone answers a stack overflow question with python 2 code. #TheMoreYouKnow
7
2
1
Jan 16 '19
I just wish I had started learning it 10 years ago!
2
u/flying-sheep Jan 17 '19
I did! (Well, 9 years) It was a little rough back then, since there was so little stuff ported!
1
1
1
-15
0
Jan 16 '19
[deleted]
20
u/james_pic Jan 16 '19
If you've got a big enterprise code base (and I'm currently working with a client that does), then it can be difficult to fix old code faster than the team is writing new code - especially since there's only usually budget for the latter.
17
u/strange-humor Jan 16 '19
This is a recipe for technical debt that will eventually put you with an output level of zero.
All new code should be written compatible with 3. Each module you touch should be made compatible. This allows slow migration to 3.
3
u/james_pic Jan 17 '19
I don't disagree with you, but clients gonna want what clients gonna want. They're currently looking very hard at what plan B looks like.
I'd also say that "new code should be written compatible with 3" sounds like a solution in theory. We tried it. But when we had a spike when we converted one of the smaller services completely to Python 3, we found that a lot of the "Python 3 compatible" code didn't actually work in Python 3 as its authors intended. If code isn't actually running in Python 3, it's probably not Python 3 compatible.
2
u/ForgottenWatchtower Jan 17 '19
Almost like you should be writing your tests for both 2.7 and 3
3
2
u/james_pic Jan 17 '19
In practice, we found that porting the tests was almost as much effort as porting the code. Both the existing code and the existing tests play fast and loose with unicode support, so to fix the tests you need to figure out whether the code should be binary or text based (which isn't just a point decision - you also need to think about the code it depends on), at which point you've pretty much figured out how to fix the code anyway.
But that was the basic plan I put to the client: use failing tests to direct migration, add mypy type hints to interfaces to clarify type usage, and start by proactively migrating the most isolated bits of code, and shared libraries. They just couldn't find the space in the delivery schedule.
2
Jan 17 '19
Yeah, the switch to python 3 wasn't just about putting brackets around print. It's a very meaningful change.
2
u/ForgottenWatchtower Jan 17 '19
Fair enough. I've never had to do 2.7 to 3 migration for a "real" app, so I'm sure it's more difficult than I'm imagining.
1
3
u/toikpi Jan 16 '19
Perhaps priorities will change when there are no security patches.
9
u/port53 relative noob Jan 17 '19
That's a problem for someone else, in the future. This year's budget doesn't have room for that.
3
u/james_pic Jan 17 '19
So, we've scoped it out, and we believe that, in practice, there will be security patches for the foreseeable future - but at a significant cost.
Several vendors have committed to supporting Python 2 commmercially after the core dev team EOLs it - most obviously ActiveState, but also OS vendors such as Canonical, as part of their paid-for enterprise offering.
1
5
u/stevenjd Jan 17 '19
And people are still using 2.7.
I know people still using 2.6 or even 2.4, and I've heard of (but never met) one chap stuck on Python 1.5 for a single legacy application they can't replace.
Don't sneer. If it works, don't break it, and for some people, 10 years just barely counts as "long term support".
1
u/FalsyB Jan 16 '19
I have to, ROS still uses Python 2. ROS 2 is here but it doesn't have big enough of community.
186
u/Data48 Jan 16 '19
TIL Python 3 has been out for roughly 10 years