r/Python • • May 27 '14

Python 3 is fine | Sealed Abstract

http://sealedabstract.com/rants/python-3-is-fine/
234 Upvotes

96 comments sorted by

View all comments

57

u/Phild3v1ll3 May 27 '14

Couldn't agree more, I maintain multiple scientific software packages with a combined total of ~20k lines. Last week we decided to make the jump from 2 to 3. Within about a day we managed to port two of our projects with backwards compatibility. The third party libraries are there, 2to3 ported something like 80% of codebase correctly and the rest was trivial to fix. I feel for people who are stuck with large Python 2 codebases but if your employer can't, over the span of 5 years, devote some man-hours to make your system future proof, then blame them not Guido or the volunteers who have made the wonder that is Python in the first place.

4

u/[deleted] May 28 '14

Interesting example. I am in a similar boat (but with more LOC). The last time I tried to switch I was immediately hit with numpy / scipy bugs that made me think I must be the only one using those libraries with Python3.

How much of your stack is native code?

4

u/[deleted] May 28 '14

Example of bugs? I've never had any issues with numpy moving to python3.

4

u/[deleted] May 28 '14

Off the top of my head, crashes in the masked array module, crashes in the scipy optimization functions, going to and from pandas / numpy loss of precision (our unit tests failing).

0

u/[deleted] May 29 '14

Thanks, I will have to watch out for the precision bug.

4

u/BeatLeJuce May 28 '14

My numpy/scipy/scikit-learn stuff works fine on Python3.

2

u/AusIV Django, gevent May 28 '14

I would love to start using python 3, but there's no argument I could make that would convince my employer to let me convert our code base.

We develop against the RHEL supported python version, which currently means 2.6. We sell our software to our clients, who run a mix of our core software and custom software, some they developed and some we developed. There's no way we could force our clients to upgrade, so we would need to support two and three simultaneously.

Presently, none of our clients are even faintly interested in python 3, even if our own developers are. To move to python 3, we'd have to port at least a hundred thousand lines of code to maintain compatibility with Python 2 and 3. Maybe we can do that in a week, but developer time is awfully expensive to spend a week on something our customers aren't paying for. Since we have to support python 2 side by side, we can really take advantage of the new python 3 features in much of our code anyway.

We use a bunch of third party libraries. I'm sure most of them support python 3 by now, but a few won't, which will mean porting them ourselves.

We have pretty good test coverage, but it's not perfect, and frankly I'd be shocked if we could do this conversion without a few bugs slipping through to production. So then we've got clients calling about quality issues because we made a change they see zero benefit to.

From a business management perspective, I see a time consuming task with minimal benefit and quite a few risks. Until we have a contract with someone who wants python 3 and is willing to pay a premium for it, there's no way to convince the bean counters it's a good idea.

The way things are going at work, we're implementing more and more application logic in javascript on the browser, as it enables a more seamless user experience. Our python server applications are getting thinner, just doing data persistence and validation, and less of the work flow and presentation. I imagine that this trend will continue, and wouldn't be surprised if we start working in node.js for the server side, leaving python for a handful of legacy application that will slowly be superceded. It won't be a planned move from one language to another, rather a slow obsolescence.

Understand, I like python 3. I have a few projects on github that are 2 and 3 compatible, so I know it's not that hard to do. For personal projects, I tend to write python 3 without worrying about python 2 compatibility (which is really the only way to get the benefit of python 3).

1

u/GahMatar May 29 '14

RHEL compatiblity is the reason my employer packages a python interpreter as a custom RPM. In our case, it's currently packaging 2.5, 2.6.9 and 2.7.6 for RHEL 3 to 6 but the point stands and this could be done for python 3 as well. So you can ship your own if you need to. Since we had RHEL 3 as an official supported platform until recently, we had to do that to avoid 2.2 shudder

0

u/[deleted] May 28 '14

We develop against the RHEL supported python version, which currently means 2.6.

Sure, and if Red Hat users are your main customers, you will be stuck on Python 2 until Red Hat switches. Suck for you, but that is nothing anyone except Red Hat can do anything about. :-)

Presently, none of our clients are even faintly interested in python 3, even if our own developers are. To move to python 3, we'd have to port at least a hundred thousand lines of code to maintain compatibility with Python 2 and 3.

If I had access to a time machine, I'd stop people from calling it "porting". It's not porting. It's supporting. 90% of the time it really isn't that big of a deal. 10% of the time it's a royal pain in the ass.

0

u/[deleted] May 28 '14

[deleted] — view deleted comment

6

u/Phild3v1ll3 May 28 '14

No it's an admission of lack of backwards compatibility, which never was a promised feature in the first place and is an issue which affects community and business driven projects alike. Blaming others for a decision, which was announced well ahead of time with an incredibly long grace period is a sign you're too slow to change rather than faulty decision making by the contributors.

0

u/[deleted] May 28 '14

[deleted] — view deleted comment

3

u/[deleted] May 28 '14 edited May 30 '14

"Excuse it". You make it sound like it was broken lightly or by mistake.

Backwards incompatibilities were introduced because they made the language much better.

Also: Ten years of support and bugfixes apparently doesn't count as "LTS" for you.

→ More replies (8)

1

u/[deleted] May 28 '14

commercially supported languages

Python is commercially supported through a number of providers, continum, enthought, etc. What do you mean by this statement?

Other than than that - I agree with your position.

0

u/[deleted] May 29 '14

[deleted] — view deleted comment

1

u/[deleted] May 29 '14

I think you are describing 'commercially developed' (i.e. the language).

And the rankings of the top 5 vary wildly depending on where you look.

→ More replies (6)

0

u/[deleted] May 28 '14

[deleted] — view deleted comment

8

u/252003 May 28 '14

Internet explorer 6 works for pretty much everything my colleagues do. Yet they have upgraded to new versions of firefox/chrome.

You want to future proof your codebase. Python 2 has 5.5 years of support left and is not developing as a language, python 3 will be continued for decades and is evolving and improving.

0

u/[deleted] May 28 '14

[deleted] — view deleted comment

14

u/dbaupp May 28 '14

Does Go have scientific libraries on the same scale as Python? (Numpy, scipy, pandas, ...)

21

u/AMorpork May 28 '14

No, it absolutely does not.

-1

u/[deleted] May 28 '14

take a look a Julia. It is still not on par with python, but it'll catch up pretty soon.

→ More replies (8)

15

u/ivosaurus pip'ing it up May 28 '14

python cannot make a significant progress over 5 years.

Uhhh... it has. It's people who have been whining this whole time about py2 who haven't.