Live data from Hacker News

Python 2.x vs. 3.x use survey

docs.google.com

61–70 of 72 posts

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

#61
post #26

Meanwhile, the Python 3 Wall of Superpowers is looking really good. 166/200 major watched projects are Python 3-compatible. https://python3wos.appspot.com

pylibmc was ported to Python 3.x in its latest release, but the wall of superpowers hasn't updated in days !

Indeed, it is ported. You can see updated list here: Python 3 Readiness (http://py3readiness.org)

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

#62
Python 2 is already on all my systems (OS X, Centos 5/6/7). Python 3 needs to be deployed.

Since I write a lot of sub 1000 line scripts for system admin tasks, it tends to not be worth forcing a Python 3 dependency just to make some small task easier.

Finally there are still a few really useful libraries that are python2 only (such as pysphere for vmware vSphere) and salt (saltstack) runs under the system python instance (py 2) that most code I write is still python 2.

Most of the code I write I try and write it so it should work on both, however without being tested and due to the nature of fairly quick development and limited testing, its almost certain there will be a few issues with running on Python 3.

Once they can convince Red Hat to replace the system python with python 3 (which will require some major work since I believe yum and a lot of other python code is not compatible), I think you will see a lot faster decline.

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

#63
post #9

I was super turned off of Python 3 when it came out and I promptly tried it and ran open("/dev/urandom").read(20) and was confronted with UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 2: invalid start byte If I had realized at the time that this error would be averted with open("/dev/urandom", "rb").read(20) I might have felt more charitable and less shocked (although I can see in retrospect th…

The easiest version is the most portable and easy to read in this case:

os.urandom(20)

Saves you from having to manage files at all, and works cross-platform.

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

#65
post #54

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…

Let's just be thankful for OpenStack dropping support of Python 2.6!

Something I can't wait for my day job to do. At least we mostly stopped using 2.3...

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

#66

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…

I really miss the ease of the print statement and therefore was very happy to discover ipython's automatic parentheses - http://ipython.org/ipython-doc/dev/interactive/reference.htm... Activating this option allows the parser to automatically infer function parentheses, just like in ruby. Though ruby still wins by virtue of its single letter `p` function.

The new print function does some nifty stuff, but I find it such an unnecessary breaking change to rip out the good ol' print statement.

In practice, the print statement is almost always much more convenient to use, but more than that, its removal represents to me the futility of the schism-- would it have hurt to let the canonical "hello world" continue to live as is?

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

#67

Is it just me, or are questions biased towards Python2?

Unfortunately, I think they are just based on the reality of the situation. According to the person who is responsible for PyPI, ~5X as many people use 2.6 than 3.X.

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

#68

Still on 2.x, simply because it's a lot easier to use the generally available system packages than constantly rolling/building your own. 2.x is not missing anything I need, so there's simply little incentive to migrate my code to 3.x until the package support is there.

Genuinely curious - which packages are you missing in 3.x?

I think falcolas means that python3 is not available as a native package (i.e. apt-get, yum install, etc) on the systems s/he programs for.

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

#69
post #63
post #9

I was super turned off of Python 3 when it came out and I promptly tried it and ran open("/dev/urandom").read(20) and was confronted with UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 2: invalid start byte If I had realized at the time that this error would be averted with open("/dev/urandom", "rb").read(20) I might have felt more charitable and less shocked (although I can see in retrospect th…

The easiest version is the most portable and easy to read in this case: os.urandom(20) Saves you from having to manage files at all, and works cross-platform.

Huh, I never knew that was there; thanks!

In production code I would probably use Crypto.Random.get_random_bytes().

Post reply on HN