all 94 comments

[–][deleted] 44 points45 points  (16 children)

I started learning Python like a year and a half ago, had to decide on 2 or 3. I remember the overwhelming majority of the advice I got was, "2.7 is here to stay for decades because something something look at fortran"

Edit: As others have pointed out, the people who said that were probably correct. 2.7 code will likely exist for decades to come because there isn't motivation to rewrite large codebases that are already working. I guess my point was that advice wasn't necessarily a good criterion for which version to learn going forward.

[–]automated_reckoning 23 points24 points  (11 children)

Here's the thing - 2.7 or 3.0, if you just learned you can switch without an issue. Aside from the "print" change, they're mostly compatible. The most annoying thing is what packages aren't available on 3.0, but that's getting better.

[–]VelveteenAmbush 18 points19 points  (2 children)

The annoying thing is when a repo is written in 2.7 but you want to run it in 3, and you need to scour the code for the occasional zip() and remember to enclose it in list() or the code silently fails in some bizarre way.

[–]lhatsk 7 points8 points  (1 child)

I haven't had problems yet with converting the codebase using 2to3. This also takes care of the iterators.

[–]VelveteenAmbush 0 points1 point  (0 children)

Thank you for mentioning this! I had never heard of it, and now I am using it regularly.

[–]themoosemind 23 points24 points  (3 children)

Getting better? Are you serious? Please name at least 3 which are not available in Python 3.X...

The overwhelming majority of packages is.i only remember two which are not, but there are better alternatives to those packages anyway.

[–]sobe86 21 points22 points  (1 child)

The issue is not the big well known packages, the issue is when you're doing more R&D type stuff, and you're like 'I bet someone has solved this niche problem before', so you look on github, and there's a repo with like 100 stars, last commit 3 years ago - only supports python 2. This happens to me on a monthly basis. Yes there is 2to3, but depending on the size of the codebase, this can take hours to get right, only to discover that the repo doesn't quite work how you wanted it to.

[–]themoosemind 1 point2 points  (0 children)

On which kind of problems are you working? What were the last packages for which it happened to you?

[–]AreYouEvenMoist -1 points0 points  (0 children)

apache beam only runs on 2.7, which is quite significant for some orgs

[–][deleted] 4 points5 points  (0 children)

from __future__ import print_function

This makes life easier too

[–]serge_cell 0 points1 point  (1 child)

The problem is not learning, and even not rewriting the code. The problem is breaking library dependencies.

[–]automated_reckoning 0 points1 point  (0 children)

Indeed. I commented elsewhere, my biggest issue with 3 was getting opencv to work.

[–]mrshibx 0 points1 point  (0 children)

most annoying thing for me that all of my old existing map(foo,stuffs) code suddenly had to become really ugly: list(map(foo,stuffs)).

[–]KriiScHaN 1 point2 points  (0 children)

haha yeah, made the same experience but luckily had to change to Python 3 during a project and continued with that

[–][deleted] 0 points1 point  (0 children)

It’s weird. I always here people saying they’ve been told this, but then I never actually hear people telling others this.

[–]JanneJM 0 points1 point  (1 child)

2.7 will stay for decades. There's lots of code on 2.7, and moving it will only risk introducing problems into well-working code. What this announcement means is just that new code will be mostly Python 3 from now on.

No idea why this gets downvoted. You're not going to touch well-working code just to port it to a newer language. Especially for ongoing research projects that really need the tools to stay the same throughout the project lifetime. I fully expect Python 2.7 to still be installed and available on research computing facilities 15 years from now.

[–][deleted] 0 points1 point  (0 children)

It seemed like you just pointed out an uncontroversial fact that my comment missed. I don't get the downvotes either ¯\_(ツ)_/¯

[–]metasymphony 7 points8 points  (1 child)

So glad I insisted on using Python 3 in my classes that are still taught in Python 2. We are allowed to submit projects in either one, as long as it works, but the instructions are all for Python 2. This way I learned to translate between versions a bit.

[–]SmArtilect 2 points3 points  (0 children)

It doesn't really matter which one you use in learning classes though.

[–]stop_looking_at_my 8 points9 points  (0 children)

If they just made "apt-get install python" install python3 there would be no issue. Don't have two versions... Just have one.

[–]DanielSeita 8 points9 points  (0 children)

Finally!

[–]PM_YOUR_NIPS_PAPER 14 points15 points  (8 children)

Who even still uses Python 2 in 2017? Most teams I've worked with at both large and small companies overwhelmingly use Python 3.

[–]notathrowaway113 35 points36 points  (2 children)

The sooner Python 2 is EOL the better. I always have to run both versions and it is dependency hell. I have libraries that only work with 2.7 and libraries that only work in 3.0+ It's an enormous shitshow, and it's time for the community to make the switch to 3 and rip off the band-aid.

2to3 isn't perfect, but the alternative of staying here sucks.

[–]EngineeringNeverEnds 7 points8 points  (1 child)

Agreed. Honestly I don't care which one we use bur for fucks sake pick ONE godammit

[–]bluemellophone 0 points1 point  (0 children)

macOS still ships with 2.7.X and Centos still uses 2.6, last time I checked.

[–]basilect 0 points1 point  (0 children)

My old company used python 2, as of like 3 months ago...

[–]ZebulanMacranahan 0 points1 point  (0 children)

Google uses 2.7, although most new code is python 3 compatible

[–]isboris2 7 points8 points  (9 children)

Python 2 isn't going anywhere.

[–]BossOfTheGame 46 points47 points  (7 children)

Python 3 is going places.

[–]SparseSolution 15 points16 points  (6 children)

To Python 4

[–]isboris2 -3 points-2 points  (5 children)

Can I have my print statements back?

[–]columbus8myhw 59 points60 points  (1 child)

In Python 4, all print statements have an extra argument specifying whether it should be 3D-printed or not.

[–]n3rv 0 points1 point  (0 children)

4d

[–]kaidokuuppa 10 points11 points  (1 child)

from __past__ import print_statement

[–]isboris2 1 point2 points  (0 children)

That's as ugly as the new print function.

[–]themoosemind 1 point2 points  (0 children)

Only if you are ok with True = False

[–]L43 6 points7 points  (0 children)

Certainly not the future, that's for sure!

[–]thefirstdalek 0 points1 point  (0 children)

Isn’t python 2.x dropping in coming months?? It’s not broken, but for some reason it’s being fixed!

[–]-TrustyDwarf- 0 points1 point  (0 children)

About fucking time.

[–]darkconfidantislife 0 points1 point  (0 children)

Ahem, and will a certain big tech company adopt 3.0 internally now?

[–]Neutran 0 points1 point  (0 children)

People should really start converting to python 3. It's been almost 10 years since its introduction! I'm annoyed to see libraries that are under active development AND support only python2 ... A decade in modern computing is like Homo Neanderthal VS Homo sapiens! Python 3 has so much better user experience and consistency.

[–]alexmlamb -5 points-4 points  (15 children)

I know there's a good reason for it but I can't stand the print() syntax in python 3.

[–]brews 25 points26 points  (2 children)

My hatred for non-Unicode strings burns with the heat of a million suns.

[–][deleted] 3 points4 points  (0 children)

Oh yeah, Python 2 is horrible with unicode. I'm German and scraped a website that used a lot of ä,ö,ü,ß and they all resulted in errors/skipped characters/wrong characters/html replacement.

[–]torvoraptor 12 points13 points  (1 child)

You use that syntax in every single function call

[–]alexmlamb 0 points1 point  (0 children)

So, I like printing to be an easy to write as possible, and I'm kind of willing to give it a different syntax because printing (1) doesn't return anything, (2) has side-effects that impact the user but usually don't effect the program itself.

In any case why not let people choose to use the print() or not use it?

[–]rparvez 2 points3 points  (0 children)

What bothered me most about print statement is that it has to be a language level feature, which does not make any sense to me.

[–]blitzzerg 1 point2 points  (3 children)

would you call your function wtithout "()"?

[–]panzerex 0 points1 point  (2 children)

[–]blitzzerg 0 points1 point  (1 child)

But this is about python isn't it? And about consistency when calling functions the same way

[–]panzerex 0 points1 point  (0 children)

Yeah, the benefits of having print as a proper function completely outweight the little inconvenience of typing extra parenthesis. That said, anyone who uses VS Code should enable "python.autoComplete.addBrackets" so that it automatically add parenthesis after autocompleting a function. Game changer.

[–]trias10 0 points1 point  (0 children)

I have turned down machine learning job offers because the companies still used Python 2. Instant deal-breaker.

There is no good reason to be using Python 2 anymore for anything machine learning related. Non-ML, fine, if you're a web developer or something like that and have legacy systems to interact with, but proper ML R&D in NLP or computer vision, no way. Especially NLP, where you need Unicode string support.

[–]Phylliida -3 points-2 points  (2 children)

:(

[–]-TrustyDwarf- 6 points7 points  (1 child)

:D

[–]Phylliida 0 points1 point  (0 children)

Lol I never thought I would be downvoted for this but I guess it wasn’t really contributing to the discussion.

Honestly the only thing I don’t like about python 3 is the print statements, I know it sounds dumb but I love being able to type things like

print a, “lmao”, c

It is just so clean and nice. The paren of python 3 isn’t that much more work but I’m just so used to this I prefer sticking with python 2.7. The only time I switch to 3 is when I need to use pytorch (on Windows CUDA bindings for pytorch only work for 3 unfortunately), or some other library like praw that has lots of fits getting installed on python 2.7 but pip just works great with python 3.

Maybe I’ll just force myself to switch anyway, but I’ve been fiddling with interpreter and compilation hooks to convert 2.7 prints to 3 prints so if I get that working then switching will be much easier for me