r/Python • • Jun 27 '18

Python 3.7.0 released

https://www.python.org/downloads/release/python-370/
1.3k Upvotes

293 comments sorted by

View all comments

202

u/uFuckingCrumpet Jun 28 '18

Finally, we can get rid of python 2.

0

u/[deleted] Jun 28 '18

[deleted]

170

u/SirCarboy Jun 28 '18

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)

133

u/ProfessorPhi Jun 28 '18

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.

6

u/Neil_Fallons_Ghost Jun 28 '18

I largely agree, but in some cases I think here’s no need. If I have a service version locked, it works, and it is secure, then why mess with it?

Once new features or serious changes are needed, upgrading would just be on the list, but really only if security and longevity were an issue.

→ More replies (1)
→ More replies (1)

56

u/ubernostrum yes, you can have a pony Jun 28 '18

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.

0

u/[deleted] Jun 28 '18

[deleted]

5

u/Ramast Jun 28 '18

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

→ More replies (3)
→ More replies (1)

0

u/[deleted] Jun 28 '18

[deleted]

5

u/Scypio Pythoneer Jun 28 '18

some only py2 compatible

Can you give examples? I only know this: http://py3readiness.org/ but believe that it is not full list.

→ More replies (8)
→ More replies (2)

51

u/BARDLER Jun 28 '18

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.

41

u/[deleted] Jun 28 '18

This all makes sense, but imho there is no reason to continue writing python2 code.

→ More replies (9)
→ More replies (13)

5

u/jsalsman Jun 28 '18

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.

19

u/uFuckingCrumpet Jun 28 '18

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.

7

u/[deleted] Jun 28 '18

[removed] — view removed comment

16

u/uFuckingCrumpet Jun 28 '18

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).

0

u/[deleted] Jun 28 '18

[deleted]

8

u/jsalsman Jun 28 '18

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.

→ More replies (4)
→ More replies (9)
→ More replies (1)

7

u/synn89 Jun 28 '18

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.

Libraries can be a real PITA to work with.

→ More replies (3)

7

u/MartyMacGyver from * import * Jun 28 '18 edited Jun 28 '18

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.

→ More replies (1)
→ More replies (11)

9

u/primitive_screwhead Jun 28 '18

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.

→ More replies (2)
→ More replies (74)

33

u/Lt_Sherpa Jun 28 '18

What about 3.7 means you can finally dump Python 2?

0

u/[deleted] Jun 28 '18

[deleted]

→ More replies (6)
→ More replies (1)
→ More replies (4)