6 ms·
"I would say there is currently no “right” or “wrong” as long as both Python 2.7.x and Python 3.x support the libraries that you are planning to use." I would
by mnm1 10y ago
"I would say there is currently no “right” or “wrong” as long as both Python 2.7.x and Python 3.x support the libraries that you are planning to use."
I would like to consider python for my next project, but this is extremely short sighted advice which begs the very real question: why should I consider python at all for a new, multi year project when there is no clear path forward for the language and there hasn't been in a decade?
Also, how can you ask someone who is new to the language to just choose? To me that seems insane. They have nothing to base their choice on, yet this choice will decide the future and success of the app. No pressure. But to be honest, and I know this is not the community's intention, the python 2/3 split is about as unwelcome a reception to a programming language as I can imagine. Is there a more logical way to choose?
Finally, I've now seen clients demand rewrites of python 2 code because of (probably bullshit) concerns around its obsolescence and lack of security. Now these clients generally don't know python from their ass and I doubt they have valid technical concerns but as invalid as their concerns probably are, it's still a major issue of your big clients threaten to leave unless you rewrite all your python 2 to 3. Anyone faced this?
- SmirkingRevenge 10y agoThe link appears to be a few years old now, so its advice here I think is a bit out of date. And some might argue it would have been out of date in 2014 as well. It should probably be updated to say that unless you have a VERY strong reason to use 2.7, use 3. And even then, probably still use 3, because your reasons probably aren't as strong as you think they are. EDIT: Generally the strong reasons most people had for using py2.7 for new projects were some variant of: "X, Y and Z libraries I need only support 2.7". But now and days, that actually stands as more of a reason to find alternate libraries.
- Animats 10y agoThe last two things I have on Python 2 are: - code that has to run on HostGator shared hosting. They only support Python 3.2, the "maximally incompatible" version. - code that has to run on ROS, the Robot Operating System. ROS is a huge collection of packages from various sources glued together by a message passing system. Efforts to convert all those packages to run under Python 3 have been underway for years, but aren't done yet.
- SmirkingRevenge 10y agoI've never heard of Robot OS, looks interesting! Yea, unfortunately its the niche stuff like that which experience the most problems (or at least I assume its fairly niche - I do nothing with robotics). In those cases, one can, without too much effort, write forward-compatible python 2 code at least.
- joshuamorton 10y agoInterestingly, most of ROS (core) is py3 compatible. Its only a lot of the libs that aren't. Unfortunately, that includes some very common libs.
- thehardsphere 10y agoWhy does the code that "has to run on HostGator shared hosting" has to live there specifically, if you can say? It should be a simple project to move that code somewhere else.
- cthalupa 10y agoThe way forward is to use Python 3. That's been the way forward since it was announced that 2.7 would be the last version, and that everything after it would just be bugfixes. The way forward became even more clearly defined when the date was set for even those to stop. I learned Python from Python 3, and it hasn't hindered me at all, even from going back and working on Python 2 code bases, or cross compatible code bases. It's a perspective that's made me just how aware of how awful Python 2 is in comparison. Python 2 is going to exist for a long time in a lot of places. But it's a dead end for improvements. It's a dead end for innovation. It's a dead end for bug fixes and security fixes. Would you even consider telling someone to go learn any other language that is 3 years away from even end of life support having the plug pulled? You wouldn't. Why would you do the same for Python 2?
- markdown 10y ago> Python 2 is going to exist for a long time in a lot of places. But it's a dead end for improvements. It's a dead end for innovation. It's a dead end for bug fixes and security fixes. One the one hand I have this from you, an anon as far as I'm concerned. On the other I have Google, filled with some of the world's best python developers (and until recently the BDFL Guido van Rossum himself). Google App Engine still doesn't support Python 3.
- scriptkiddy 10y ago> Google App Engine still doesn't support Python 3. Um, yes it does: https://cloud.google.com/python/quickstarts https://cloud.google.com/python/quickstarts
- elithrar 10y agoYou're both half-right: the "standard" App Engine environment is "Python 2.7 only", via the link you just gave. The newer, flexible env (with less bullt-ins) does 3.x too.
- bmon 10y agoRight, because Google likely has a tremendous codebase which would prove difficult and costly to port. If they were making a decision today and had no existing python systems, do you think they'd choose the version that's going to be EOL in less than three years?
- mrout 10y agoThere is a clear path forward. It's Python 3. The Python community unanimously agrees that the way forward is Python 3. Many libraries are planning to drop support before 2020, many have already dropped support, and the rest never supported Python 2 in the first place. Python 2's official support ends in 2020. How can you ask someone new to the language to just choose? Well they don't have to choose. They just choose Python 3. That's what it says on the Python website. It's what everyone in the community says.
- scriptkiddy 10y agoHere's the advice I usually give: Do you need to use packages that only support Python 2 and there are no alternatives? Use Python 2. Otherwise? Use Python 3. If someone doesn't know whether they should be using 2 or 3, they should be using 3.
- stcredzero 10y agowhy should I consider python at all for a new, multi year project when there is no clear path forward for the language and there hasn't been in a decade? It would seem that the article is out of date and there is now a clear path forward. However, I think that we also see here a problem with the BDFL model of programming language governance. Unless Python 3 is somehow well over 2X times more productive than Python 2, I don't see the amount of disruption caused by the change as having been worth it. Is that the case?
- matt_wulfeck 10y agoI agree. I'm sure it's much easier for Python 3 core language development to happen versus 2, but for a regular joe what carrots are there, or is it really all sticks?
- xapata 10y agoCheck out the "what's new" documents for the various Py3k versions. v3.6 had very nice additions.
- matt_wulfeck 10y agoThere's no reason those enhancements couldn't be part of 2 other than the maintainers decided to abandon the language for their own maintabity. That's their peragotive, but doesn't provide material benefits to the actual users.
- xapata 10y agoThe maintainers implemented enhancements in both 3.x and 2.x for many years. Eventually they got tired of it. Version 2.7 corresponds to 3.4. The reason why 3.5 is the first 3.x that started to gain a following was that Guido announced there'd be no 2.8. You could argue that the reason folks didn't adopt 3.x quickly was that the core devs stayed committed to 2.x. It's standard practice for software maintenance to work on both the old version and the new fork for a while, giving users a chance to switch. Look at how Microsoft manages versions of Windows. I think the Python devs stand out in their willingness to work on both versions for so long.
- syrrim 10y ago> why should I consider python at all for a new, multi year project when there is no clear path forward for the language and there hasn't been in a decade? What does a "clear path forward" mean in the context of a programming language? In what way does python not have one? >yet the choice will decide the future and success of their app No it won't. I would argue that programming language choice generally has little effect on success, but it has even less effect when the languages are as similar as python 2 and 3. >rewrites of python 2 code Hardly a rewrite, I presume. They would need to change their syntax in some places, change package names in others, and any place they've dealt with strings might require some fiddling, but overall it would be relatively easy. Much easier than a rewrite at least.
- mastazi 10y ago> how can you ask someone who is new to the language to just choose You don't have to choose. For new projects, Python 3 has been the way to go for many years now[1][2]. [1] PSF wiki guidelines https://wiki.python.org/moin/Python2orPython3 https://wiki.python.org/moin/Python2orPython3 [2] Snapshot of the same page from 2011, clarifying that "Python 3.x is the present and future of the language": https://web.archive.org/web/20110902011248/http://wiki.python.org:80/moin/Python2orPython3 https://web.archive.org/web/20110902011248/http://wiki.pytho...