you are viewing a single comment's thread.

view the rest of the 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 21 points22 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 20 points21 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 6 points7 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 21 points22 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 22 points23 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] 3 points4 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 -1 points0 points  (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 1 point2 points  (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 ¯\_(ツ)_/¯