As an example of why Python 2 is going to be the primary Python for me due to circumstances beyond my control, the following two are examples of open-source "Python" software I (and a huge percentage of the structural biologist community) use for 75%-85% of work:
Both work on Python 2 only! So guess what, I have to write all the extensions and analysis plugins in Python 2 if want them working with those packages.
Want to even dare trying to move those two packages to Python 3? See you in a decade!
The projects that don't use it probably need to maintain compatibility with Python 2, for whatever reason. I expect that more and more codebases will be at least somewhat typed as Python 2 is deprecated everywhere.
It’s lucky Python 2 isn’t supported anymore then, and everyone has had like a decade to run 2to3 once and publish a package for Python 3, so that use case becomes meaningless.
True, but at the same time it's odd for open source projects to not have py3k compatibility. Hell, the stuff I have on github has no python 2 compatibility because honestly after spending some time in Python 3 it really feels like a step back (compared to bytes vs strings, etc.). Unless you are getting paid or depend on libraries that are only on py2, why would you use python 2 instead of 3?
Joking aside, Python 3 is the only Python. The only people who should use Python 2 are those supporting legacy codebases, and even they should start migrating.
I used to put it off, especially because (a few years ago) I was working with a package that used Twisted, which was Python 2 only. (Not sure if it still is.)
Since PyCon a month ago, however, I've been making a conscious effort to use Python 3. Python 2 has less than 4 years of life left! [0]
I'm a Python developer and I still only write in Python 2. I'll sometimes release projects and make them compatible with both Python 2 and 3, but for any personal or professional (non-open source) work I use Python 2.
Python 2 still has too much pull. Lots of smaller open source projects and third party libraries use 2, as do little snippets and examples all around the Internet. I've never found a case where a project I wanted to use, modify, or borrow from supported 3 but not 2, but the inverse is unfortunately still quite common.
I think Python 3 is a better language over all, but it's easier for me as a developer to keep using what I know will be supported and compatible.
All my libraries have been py3-only since around last year. I'm also not caring much about supporting 2 on the old ones I maintain. 2 is pretty old, it's time to move on.
Working in open source on a variety of projects, many of us are starting to look forward to a Python 3 only world, and Python 2.x is not where we develop.
You are going to start seeing libraries come out that don't test on Python 2.6 and don't work there either.
You know, when I am working on an existing project for a client that's allotted 15 hours a week to it, and I have to get actual features pushed out, I don't have time to check which of the 25+ dependencies I list are going to work in Python 3. Sure, maybe I can start a new project in Python 3, but there are enough existing projects to not be able to do this.
Also, even if I am starting an existing project, what if down the line I must use a library that's only available for Python 2? I am not going to rewrite something like that because it will cost my client money if I spend time on it.
The problem with Python 2 is that it's good enough. Python 3 is a huge improvement, yet until I can be reasonably sure that all libraries I am likely to use are available for both, Python 2 is the winner.
Having said that, any personal projects I have started recently have all used Python 3 and it's been great. I also try to make sure that any libraries I write work in both.
What I've been seeing is people using Python 3 for new projects but leaving their older projects on Python 2. As a result of that, Python 2 will continue to be supported internally at a lot of companies, even though it is "officially" end of life. Nobody wants to rewrite the stuff they finished years ago that is now in maintenance mode.
What's use of Python 2 if you can't use libraries[1]?
It will only get more difficult to maintain your app.
[1] https://python3statement.org/ - note many libraries weren't even waiting until 2020. It is a lot of work to maintain code with python 2 cruft. Not all packages are listed there, for example Django is Python 3 only, starting from 2.0 (currently at 3.0)
> Python 2 -> Python 3 had (has) source incompatibility, which is a nightmare to deal with, especially because the changes are of a nature that make it difficult to port code automatically and reliability. (Contrast with Go pre-1.0 -> Go 1.0, which had source incompatibility but an automated code transformation tool).
I guess you're aware of this, but Python has the 2to3 tool[1], which does a lot of transformations automatically. (Obviously not all of them, but it's good enough that it's the recommended way[2] to support Python 2 and 3 in one codebase.)
I was a staunch Python 3 supporter until I encountered such a thing. I avoid Python 3 now because I don't want to be forced to make a decision between writing the requisite library myself (a huge undertaking), abandoning the project entirely, or rewriting everything into Python 2 again. Better to just start with Python 2 in the first place.
Python 2 will still be there, why spend energy back-porting stuff when you could just keep using python2 or improve python3 or even porting to python3 (it's actually not that hard).
http://sourceforge.net/projects/pymol/
http://www.phenix-online.org/
Both work on Python 2 only! So guess what, I have to write all the extensions and analysis plugins in Python 2 if want them working with those packages.
Want to even dare trying to move those two packages to Python 3? See you in a decade!
reply