top | item 6993561

Ask HN: What would it take for you to switch to Python 3?

9 points| rectangletangle | 12 years ago | reply

Judging from the numerous other threads it seems like the primary complaint has been lack of third-party library support. Now that Django, SQLAlchemy, Numpy, Matplotlib, BeautifulSoup, NLTK, and PIL (as Pillow), support 3 it seems like this just isn't a valid complaint anymore. If library support is still the issue, what libraries need be ported to 3 in order make the switch palatable for you?

The other common complaints seem to be against the GIL. Which from what I've gathered, there doesn't seem to be any adequate solution for yet.

Python 3.4 comes with an intriguing new asyncio library, as well as new enumeration and statistics libraries. These seem like they may be tempting enough to coerce some users into making the switch.

Ubuntu 14.04 LTS is supposedly shipping with Python 3 as the default version. I personally think this is what it will take to garner wide spread adoption.

So, what will it take for you to make the switch?

13 comments

order
[+] dded|12 years ago|reply
There are over 300 replies in the discussion here (About Python 3): https://news.ycombinator.com/item?id=6985207 From what I've gleaned from that discussion, here are reasons why people aren't moving from Python2 to Python3. These are in no particular order, other than I repeat the two you mention first.

1. Lack of library support (as you indicated). I'll confess to not paying careful enough attention to know what specific libraries are desired.

2. Lack of a big enough carrot. I think this is what you mean when you mention the GIL. After all, Python2 also has the GIL, so its presence in Python3 is not a reason not to upgrade; but its absence might be a big enough motivation for some people to upgrade. Other wanted features that I recall include JIT compilation and tail call optimization; but I probably didn't pay enough attention to specifics here, either.

3. A claim that Python3 is inferior for interactive use. One complaint is that print is no longer a statement, but I can't help but wonder if some people don't realize that if a variable or expression is entered in the REPL it is automatically printed (the P in REPL). The prevalence of iterators over lists is also cited in this space.

4. Byte strings don't work well for those who need them. The Mercurial folks had something interesting to say about this, but others had complaints too. Sometimes little things don't work: one poster mentioned that byte strings can't be used as a key to a shelve object, element selection can't be combined with concatenation, etc.

5. The mismatch between Unicode strings in Python3 and C strings in Unix-like operating systems. This one is the one I care about and is thus the direct answer to your question.

6. What I might call petty complaints, but won't lest people call my complaints petty: lack of print statement (I don't get it, but it was very popular), true division, etc.

[+] rectangletangle|12 years ago|reply
That's pretty much what I discerned. However, #5 is a new one and makes complete sense. Though, I've never ran into that problem myself.
[+] iposbeforehoes|12 years ago|reply
This is going to sound sad, but I can't figure out how to install Python 3 and run a script with a single package.

Seriously. I've programmed for 5 years, studied CS, and I really don't understand how to do it.

I have a Mac Book Pro Retina, so it ships with 2.7. I write Ruby in various versions via RVM, and I have no idea what version of Node I use, but I use it a lot.

Over the Holiday I decided to try to port some Node services to Python (mainly because they are analytics projects and I'd like to start using Python for analytics and "data science" ). And I struck out. Bad. Using Homebrew to install Python 3[.3] and no success with virtualenv and Pip. At best I get a pip-3.3 to install and crash anytime I try to install a package.

I would love to convert these services to Python 3. In fact, I'll regret not doing so. But at this point, it really isn't worth my time trying to figure it out. Once I accepted installing my packages via 2.7, I was able to convert the services (with tests!) over a long weekend.

I did a fair amount of research through Google and Stack Overflow, and each confirmed my suspicion that this process is shit.

I just saw a tweet by @holman where he described a friend saying 'how can ruby be such an easy language but be so hard to install?' And asserted that our industry still sucks (and in my opinion Ruby in any incarnation is infinitely easier than Python).

He is so right.

[+] rectangletangle|12 years ago|reply
Did you try to compile Python from the source at any point? Or are your installation issues solely with PIP; if so, you can probably manually install packages with something along the lines of

    $python3 ./somepkg/setup.py install
[+] treeform|12 years ago|reply
Issue is python3 is not that much better then python2. Simply make it much better:

1. 64 bit psyco (http://psyco.sourceforge.net/) OR another JIT compiler that is just as good. Maybe Cython like optional typing support.

2. Greenlet like networking in core that we don't have to dance around. Maybe asyncio does it.

3. Tons of people proclaiming how much better py3 is. Frankly it might be there I just don't know. We need peer pressure.

[+] trothamel|12 years ago|reply
More time?

A problem is that time I spend porting to Python 3 is time I don't spend adding features to my application. I'm probably going to bite the bullet this year and port. But it's likely to cause problems (just because I'm modifying debugged code), without providing a lot of benefit to the people who use my code.

[+] ribbit_flower|12 years ago|reply
Two things (#1 is more important to me):

1. Documented and significant performance improvements. 2. A really good guide to how the hell strings work in Python 3, I still don't really understand how to go between unicode/bytes, etc.

[+] jbeja|12 years ago|reply
Until Kivy or Flask do not support python 3 i will not switch :p
[+] Rhapso|12 years ago|reply
Reverse compatibility.
[+] davvid|12 years ago|reply
From the CG camp: Getting The Foundry (Nuke), Autodesk (Maya), and SideFX (Houdini) to ship support for both Python2 and Python3 would help.
[+] jardaroh|12 years ago|reply
more OSes to ship with python3 as default would help. I guess another thing that would help is to change the narrative, even just a year ago python3 was said to be bleeding edge and if you wanted to make something production ready you should go with python2, so I did. Basically, sell python3 better to both existing and new users.