Live data from Hacker News

New features you can't use unless you are in Python 3

asmeurer.com

91–100 of 264 posts

Re: New features you can't use unless you are in Python 3

#91

Earlier quoted context omitted.

Python 3 has been available on most dists for 5-10 years.

What I said was the default version of Python is old on most distributions. For example, CentOS 6 ships with Python 2.6 out of the box. Even faster moving distros (like Ubuntu) are still trying to make Python 3 the default (although at least Ubuntu ships with both 2.7 and 3.4+ out of the box).

https://ius.io

Re: New features you can't use unless you are in Python 3

#92
post #20

Does anyone use 2.x by choice? I've only seen it required as to not break legacy code.

I haven't figured out the proper incantations to install matplotlib on python 3.x on OSX. So I stick with 2.7.

> conda install matplotlib

Anaconda Python really should be more popular on OS X and Linux than it is. Homebrew is okay, but a little bit wonky for Python packages.

Re: New features you can't use unless you are in Python 3

#93
From: http://www.asmeurer.com/python3-presentation/slides.html#55

... why is this good:

    def dup(n):
        for i in range(n):
            yield i
            yield i
... but this one better?

    def dup(n):
        for i in range(n):
            yield from [i, i]
... it would seem you're needlessly creating (1): another level of generators, and (2) creating a real list

Re: New features you can't use unless you are in Python 3

#94
post #20

Does anyone use 2.x by choice? I've only seen it required as to not break legacy code.

I haven't figured out the proper incantations to install matplotlib on python 3.x on OSX. So I stick with 2.7.

Have you tried installing anaconda?

Re: New features you can't use unless you are in Python 3

#95
post #54

Earlier quoted context omitted.

What I said was the default version of Python is old on most distributions. For example, CentOS 6 ships with Python 2.6 out of the box. Even faster moving distros (like Ubuntu) are still trying to make Python 3 the default (although at least Ubuntu ships with both 2.7 and 3.4+ out of the box).

What do you mean, default ? "/usr/bin/python" symlinked to "/usr/bin/python3" instead of "/usr/bin/python2"?

Installed by default.

Re: New features you can't use unless you are in Python 3

#96

Earlier quoted context omitted.

This shouldn't be downvoted, it's a legit question. I hear some people really really prefer `print as statement`, but I've never seem them in real life.

Just from __past__ import print_statement I really hope someone makes this work. I literally laughed and thought that it was a troll the first time I saw the future print import and that being used as a compelling reason that I should switch to Py3.

I don't think print() is what I'd call "compelling", but I for one am quite glad to see this go:

    print "Text",
For those not familiar with Python 2's syntax: that trailing comma is significant. And it's pure syntax; it's not the creation of a tuple either…

Re: New features you can't use unless you are in Python 3

#97
post #88

TL;DR: The important stuff that makes a good case for Python 3: - Adittion of "yield from" allows easier programming with async I/O "a la " Node.js (using 'await') - Standarized annotations of function arguments and return values can help in the future for type checking, optimization, etc. Even more important stuff - Unicode can be used in symbols. You can now use Kanji characters in your function names, to annoy you…

Of those, only the async I/O stuff seems compelling. But compelling it is, at least as used in Curio. It feels like this is still shaking out, with the standard library and Trio (?) alternatives, but it looks really cool.

If you work with international users full unicode support is very compelling.

Re: New features you can't use unless you are in Python 3

#98
post #54

Earlier quoted context omitted.

What do you mean, default ? "/usr/bin/python" symlinked to "/usr/bin/python3" instead of "/usr/bin/python2"?

Installed by default.

Isn't Python 3 installed by default on most distros, as well as Python 2?

Re: New features you can't use unless you are in Python 3

#99
post #67

Earlier quoted context omitted.

It was source-level incompatible with older code so it couldn't be used as a smooth transition like... almost any other language upgrade I've ever seen. Breaking code like this was a big mistake in my opinion - it resulted in many people sticking on the old version for code and library compatibility. There are still libraries which don't work on Python 3, though now fairly few of them. In addition to that, the unicod…

> It was source-level incompatible with older code so it couldn't be used as a smooth transition like... almost any other language upgrade I've ever seen. Ruby released the source-incompatible Ruby 1.9 just months before Python 3. IIRC most versions of Swift have been source-incompatible with each other. Even a language as buttoned-down as C++ has made source-incompatible changes[1]. I have no idea where people got t…

I don't know how Ruby handled it, but Swift and C++ have the advantage of being a static typed language, and most breaking changes can be detected by the compilers. When you transition from Python 2 to 3, you never know which line will explode when you run it.

Re: New features you can't use unless you are in Python 3

#100

Earlier quoted context omitted.

Just from __past__ import print_statement I really hope someone makes this work. I literally laughed and thought that it was a troll the first time I saw the future print import and that being used as a compelling reason that I should switch to Py3.

Consistency and keyword args are useful.

"11. There should be one-- and preferably only one --obvious way to do it." from the Zen of Python. Somebody intentionally misread it as, "There should be only one way to do it." They obviously made a grave mistake. Same with many 2->3 changes.
Post reply on HN