Live data from Hacker News

Python 2.x vs. 3.x use survey

docs.google.com

41–50 of 72 posts

Re: Python 2.x vs. 3.x use survey

#41

This reminds me of a Flask mini project I did. I was doing it in Ubuntu (LTS if I'm not mistaken). I picked python3 and ran with it. As I tried to use Python's virtualenv (venv), I went down the rabbit hole of a broken mess that was left in Ubuntu. I just reinstalled Ubuntu this week so I might give it another shot, but every time I try to do something with Python I end up with a broken mess, and that's disheartening

> As I tried to use Python's virtualenv (venv), I went down the rabbit hole of a broken mess that was left in Ubuntu. What do you mean? virtualenv exists exactly so that your libs are installed in your local directory and not globally in the system. I'm not sure how it could result in broken mess in the system that way.

This is the bug I'm talking about: https://bugs.launchpad.net/ubuntu/+source/python3.4/+bug/129.... I think the distro was Ubuntu 14.04 LTS, but I do not remember exactly

Re: Python 2.x vs. 3.x use survey

#42
post #14

This reminds me of a Flask mini project I did. I was doing it in Ubuntu (LTS if I'm not mistaken). I picked python3 and ran with it. As I tried to use Python's virtualenv (venv), I went down the rabbit hole of a broken mess that was left in Ubuntu. I just reinstalled Ubuntu this week so I might give it another shot, but every time I try to do something with Python I end up with a broken mess, and that's disheartening

AFAIK -mvenv is still kaput in Ubuntu. I just this instead: sudo apt-get install python-virtualenv python3 virtualenv -p/usr/bin/python3 Yes, it'd be way cooler if -mvenv wasn't crippled in Ubuntu, but this still works fine.

Yea I was doing this until I also ran into a horrible mess later on due to the underlying issue that resulted in a catch 22 (something like pip is broken because venv is broken because pip is broken...). Unfortunately I didn't see [this tweet](https://twitter.com/danilobellini/status/461653494295179264) at that time, or things might have turned out differently

Re: Python 2.x vs. 3.x use survey

#43
The only app I wanted to use that required v3 Python was Beancount, but I couldn't get it to work, because it required v3.3, while Cygwin only has 3.2 and I myself was unable to compile Python v3.3 or later on Cygwin. (It doesn't work as it is, I tried to google and apply patches, got it to compile, but tests failed, so I gave up; no Beancount for me.)

Re: Python 2.x vs. 3.x use survey

#44
post #36

App Engine supports Python 2.7. this was a deal breaker for python 3 usage for me.

Google is super slow in supporting Python 3 for anything, their python API client still hasn't been ported. It's the only dependency for one of my old projects that makes it unportable to Python 3

Re: Python 2.x vs. 3.x use survey

#45

I write all of my side projects in Python 3.4. I only write 2.7 because I work on Openstack at my day job. I avoid the use of Python 2 in every situation I can. Python 3 has better modules built-in; the existing modules have been cleaned up; a cleaned up language (no more xrange, lazy map/filter/reduce, explicit byte-stream encoding); an improved language (sub-generators); optional type annotations; configurable allo…

As one of those crazy functional programmers who uses python, can you please explain to me what the benefit is in remove xrange, lazy map/filter/reduce, and other functional mainstays in exchange for what is essentially more syntax to do the same?

Re: Python 2.x vs. 3.x use survey

#46

I write all of my side projects in Python 3.4. I only write 2.7 because I work on Openstack at my day job. I avoid the use of Python 2 in every situation I can. Python 3 has better modules built-in; the existing modules have been cleaned up; a cleaned up language (no more xrange, lazy map/filter/reduce, explicit byte-stream encoding); an improved language (sub-generators); optional type annotations; configurable allo…

As one of those crazy functional programmers who uses python, can you please explain to me what the benefit is in remove xrange, lazy map/filter/reduce, and other functional mainstays in exchange for what is essentially more syntax to do the same?

well, range in python 3 is lazy. They replaced the non lazy implementation with xranges impl.

Same applies to map, filter and I believe reduce as well.

Re: Python 2.x vs. 3.x use survey

#47

I write all of my side projects in Python 3.4. I only write 2.7 because I work on Openstack at my day job. I avoid the use of Python 2 in every situation I can. Python 3 has better modules built-in; the existing modules have been cleaned up; a cleaned up language (no more xrange, lazy map/filter/reduce, explicit byte-stream encoding); an improved language (sub-generators); optional type annotations; configurable allo…

As one of those crazy functional programmers who uses python, can you please explain to me what the benefit is in remove xrange, lazy map/filter/reduce, and other functional mainstays in exchange for what is essentially more syntax to do the same?

It's the other way around, they are not removed, the default implementations are now lazy. So in python 3 you get an interator:

   >>> map(lambda i:i*i, range(5))
   
and have to explicitly construct a list:

    >>> list(map(lambda i:i*i, range(5)))
    [0, 1, 4, 9, 16]
    >>>

Re: Python 2.x vs. 3.x use survey

#49
post #14

This reminds me of a Flask mini project I did. I was doing it in Ubuntu (LTS if I'm not mistaken). I picked python3 and ran with it. As I tried to use Python's virtualenv (venv), I went down the rabbit hole of a broken mess that was left in Ubuntu. I just reinstalled Ubuntu this week so I might give it another shot, but every time I try to do something with Python I end up with a broken mess, and that's disheartening

AFAIK -mvenv is still kaput in Ubuntu. I just this instead: sudo apt-get install python-virtualenv python3 virtualenv -p/usr/bin/python3 Yes, it'd be way cooler if -mvenv wasn't crippled in Ubuntu, but this still works fine.

I know this is a bit of a dirty trick, but so far it has worked without problems for me at least:

The issue seems to rise from a missing ensurepip module. I fixed this by just downloading the Python 3.4 sources, unpacking them and copying the unpacked lib/ensurepip/ to /usr/lib/python3.4/ after which python3 -m venv seems to work fine.

Re: Python 2.x vs. 3.x use survey

#50
Let's be honest. The fact that surveys like this are still around 6 long years later has just become boring.

I have moved to Python 3 purely because of asyncio. There is no other reason that I have found Python 3 to be compelling for. When I write Python 3 now, I feel like my favourite language has gone all "serious" on me, like it wanted to grow up, and has lost a lot of its charisma on the way. I actually liked the print operator for example - it's probably the reason I chose python in the first place when I saw

  >>> print "hello world"
for the first time. That's it? So clear and simple!

3.0 has lost some of that. The unicode thing is also just irritating because 99% of the time ascii works very well and is less complicated, thank you very much.

Also, no matter what anybody says, you still bump into libraries that you need that are 2.x only (in my case Bloomberg). It doesn't matter if most libraries are ported if just one library that you need is not ported yet, you're back to 2.x. Imagine you're an average coder who uses say 8 libraries. By the ratio of 15% not yet moved, you're almost certain to have a problem (1 - 0.85 ^ 8 > 70% chance). Anyway I have been able to manage because I have isolated the 2.x dependencies in another system, and I have put in the effort only because I really like asyncio, and it's finally clear to me that Python 2.x has no future. That said, and taking that logic even further, the very fact that this 2v3 issue is still around is irritating, and has been irritating a lot of people for a long time. I am wondering about going the whole way and moving to another language altogether (Golang and/or functionals).

One more thing to point out. If you're beginning in Python, the vast majority of code samples on the internet are 2.x. That's fine if you have any clue about Python as the surface differences are not that large, but it is definitely a pain if you're expecting to copy and paste and have things "just work".

Post reply on HN