Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: What scenarios is Python 3 a bad idea to use, versus Python 2?
5 points by jamesmishra on Aug 21, 2014 | hide | past | favorite | 3 comments
For years, I've been avoiding Python 3 in production out of concern for poor library support, a lack of an installation base on end user systems (although most of my code runs on my or my employer's servers), and so other Python 2 developers could comfortably contribute to my code.

There have been a series of articles over the years about the Python 2 vs 3 issue, but now most of them don't reflect the state of affairs on today--August 21, 2014.

The website http://py3readiness.org/ puts us at support for 270 out of the 360 most important packages. I suppose that's enough for most projects, but what scenarios is Python 3 inappropriate for?

On the other hand, Paul Graham's "Beating the Averages" suggests the use of the best language possible for server software, but it's still not completely apparent to me whether Python 2 or 3 is the better language in that context.




There is hardly any reason these days to use 2.7 over 3.x for any greenfield project. You would have to be really really sure a non ported package was absolutely vital.

That said there is a considerable number of commercial companies who are on 2.x and staying there for the foreseeable (as in "yes we really should move but ...)

I divide these into three camps

- the distribution has 2.x. Some people are still on Ubuntu 12.04 or 10.04 and not planning a move because there is not enough sysadmin resources.

- 2to3 lite: we could move but we have not bothered yet, but 2to3 will auto correct everything anyway.

- we genuinely have too much built on old libraries and old infrastructure that the move to 3 is actually slightly scary

The first one is lack of technical leadership, the second is similar but actually solvable and the third is rare (but I can name a couple of mega corps with that problem)

My suggestion - start on 3.4, building your project on top of it, focus on good Unicode practises anyway and if you find a library that must must must be used and is 2.x only - set it up as a micro service and use it that way :-)


There should be no reason to use python2 over python3. Your argument:

> I've been avoiding Python 3 in production out of concern for poor library support

Is the exact problem the python community has at the moment. If everyone takes this stance then the projects will never be move forward.

Why not make the point of using python3 and porting or fixing code where it is broken. Tools like py2to3 make moving from python2 to python3 so much easier.

Your question:

> but what scenarios is Python 3 inappropriate for?

Python3 is inappropriate for the situations where python as a language is an inappropriate solution.


There are a couple of scenarios:

- You want high performance and hence you want to leverage pypy, which has far better support for python 2 than for python 3.

- The libraries that you're using don't have good python 3 support. Flask used to have some problems with 3, but no longer does. Many companies have a lot of code written in Python 2 (dropbox), and hence using python 3 would not be a good idea.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: