Budget to migrate legacy code would be one reason. Having worked in a small dev team for a large non-tech company, we had plenty to do and updating working code was a luxury we couldn't afford. *(didn't want to spend on)
And no one wants to do it. It's painful, error prone, you get all the blame and no one appreciates the impact since it's not immediate. Out of a team of 20, only me and another programmer would push it whole the rest were all interested in getting new features out instead.
Technical debt is a very poorly managed aspect of programming.
Yeah, but that's not really a Python 3 thing. That's a "you were never going to do any kind of upgrade of anything" thing.
A lot of places that talk about Python 3 being a hurdle are really covering for any type of maintenance or infrastructure work being a hurdle due to their organizational structure.
Pretty sure such vulnerability could still be patched. If not officially by python foundation then someone from the community will step in to submit it. If its big enough , people would even consider a fork.
Would still be much faster and cheaper than migrating thousands of projects of many different companies to python 3
Because Python is used for a wide range of applications including a lot of code that is never released outside of the company that uses it. The time lost vs the benefits gained from switching to the newest version of Python is not worth the investment. Python 2 can do everything Python 3 can in terms of the results you can get out of it even if the implementation might be better in Python 3.
I just had to set up a Google Cloud VM instance today. All their infrastructure code is Python 2.7, and there's a lot of it. There's just not a lot of added value in v3 to justify the risk and expense of going through all that legacy code.
There are probably a lot different reasons. Some that occur to me are:
- Python is pretty frequently used by non comp-scientists are are generally less inclined to embrace learning new languages (or changes to languages they are already comfortable with).
- Moving from Python 2 to Python 3 typically breaks stuff. So unless you start something in Python 3, it's usually a headache to get everything back up and running if you switch.
- Not all libraries get updated. This again goes somewhat back to non CS people contributing lots of code but not necessarily having the interest to update for newer versions.
- The differences between Python 2 and Python 3 aren't drastic enough to convince most people to switch.
I'm sure it depends quite a bit on what field you're in. In Physics & Astronomy, for example, it is VERY common for a person (or group of people) to build some kind of analysis tools in python or a set of wrappers to help interface python with some existing C++ code and then 100% abandon it once it functions. Whatever version of python was most current when it was written is very likely the only version it will ever successfully run on. I can't necessarily speak to CS fields, but in the physical sciences it's pretty typical for people to write lots of code and follow none of the best practices (e.g. commenting code, handling package dependencies, etc).
Linear algebra people still use Fortran because someone optimized the row-access cache behavior sensing in the 1970s and it still runs fastest that way. Those libraries like LINPAK are still in use, as compiled from Fortran and linked into object files for all kinds of numerics libraries inner loops, including Python's.
Yeah, but let's say you're using goodlib v1.0 and v2.0 of the lib breaks some things so you hold off on updating that library. Years later Python 3 support gets added but it's only in goodlib v6.0+
So now you not only have to get your app to work with Python 3, but also update goodlib(and probably many more libraries) that may change in small ways between major versions.
Heck, I recently updated a PHP app using AWS S3 and stayed in the same AWS SDK 3.x branch and the update broke(changed) how the library returned S3 domain urls for buckets. Luckily I had excellent test coverage which caught and pointed out the change. But that was within the same major version using a very common library from a huge vendor.
The people in sciences holding onto 2.7 arn't using goodlib, they are using in house libraries that were developed to do a specific thing by someone years ago, and that all of their results and model have been validated against this, and that nobody has the time or effort or willpower to modernize the code and then to re-validate everything. Most of the people in the sciences writing these codes are not computer scientists, they are regular scientists. They are working for effectively peanuts, are fighting every single day to justify the little funding that they do get and to apply for more funding so that they may actually finish their work, and most of the time they have only 2-5 years to do this. And during this time, they are also under increasing pressure to do new research, to publish new research, and to come up with ideas for new research. They (we) go into our labs/office every day and have to make the decision: do I use the limited time i have to do research to get me to my next job/position/grant, or do I go through and update the codebase that I use that I know for a fact works right now as-is? I can't speak for everybody, but I know that I would choose the latter every single time.
Edit: And during all of this, I am already devoting some of my time tutoring/mentoring students, correcting exams, homework, grading papers and reviewing new journal articles, coming up with lecture notes for that class they need to teach, coming up with homework or exam questions, and dealing with whatever my superiors ask me to do for them that day.
At the end of the day, my job as a scientist isn't to produce beautiful idiomatic code. It is to produce results that give insight in helping me answer the questions that formulate my hypotheses. The code is secondary and is only a tool that I use to get to those results. In fact what I'm after isn't even the results, but the analysis and interpretation of the results, the answer to "so what does it mean." Best-coding practices come second to getting the results. Sure, as I write my scripts and library codes I'll attempt to follow best practices, but not at the expense of so much wasted time.
There are a lot of libraries that are or will soon be Python 3 only going forward.
Keep learning Python 3, be aware of Python 2, and steer clear of companies that plan to stay on Python 2 indefinitely. You'll hear 1001 excuses, and they all come down to:
They're too lazy
They're too cheap
They won't be around much longer
They'll be around forever, and your headaches will grow exponentially the longer you are there
It's worth the work to stay up-to-date, or within a close range (IMHO 3.6 is the sweet spot until 3.7 is widespread).
Edit: Oh yes, and unless you like painful surprises when it comes to ANY Unicode input/output, stick to Python 3. Requires a bit more thinking when it comes to strings, but it handles them while Python 2 routinely surprises you in painful ways at inconvenient times when it encounters a Unicode char it can't handle in some part of your code you never thought it'd even hit.
I know I'm a bit late, but as someone who is just porting over Python 3, the big library issue for me was wxPython. It's a very complex GUI library that would have taken me hundreds of hours to replace. They became Python 3 compatible January of 2018. Keep in mind that even if most libraries are compatible with 3, all it takes is a single non-compatible library that is hard enough to replace to stop an upgrade to 3 dead in its tracks.
When I first started writing scripts, I noticed some slight differences in the syntax that were made between 2/3, but it seems like those would be simple to address even in large scripts.
They aren't.
First, it's not just "scripts", many people have huge codebases based on Python, running complex interworking services. Secondly, the change to strings becoming unicode (instead of raw bytes), is *hugely* impactful for many kinds of work. Just as unicode strings made it (presumably) easier for many programmers, it also made things very much harder for others, not just for the transition to 3, but for new code as well. The autoconverters often can't help here.
That said, the recent work on type annotations, etc. may help the stragglers to start to safely convert; it's still a large and potentially costly job, though. Things like the improvements in dictionary space usage, and other recent features, may also finally be enough of a carrot.
One last inhibitor is that whereas many Linux distros, and MacOs have come with a version of Python 2 for many years, a version of Python 3 has often only recently started showing up. I think that also had a significant effect on early adoption.
0
u/[deleted] Jun 28 '18
[deleted]