Live data from Hacker News

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

asmeurer.com

21–30 of 264 posts

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

#21
Alternative view titles:

Zero - The Number of Applications that Can only be Developed in Python 3

or

7456324 - The number of companies that only use Python 2.x

Although these made up titles are slightly tongue-in-cheek, they do server to illustrate that for me at least, I do not have a compelling reason to switch to Python 3.

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

#22

The new keyword-only arguments look great, but it looks like it relies on adding a " * " parameter that allows any number of arguments. What if I want the safety of keyword-only arguments, but I don't want varargs? Is there a way to do that?

This is covered in the link. Just put a * without a name, as in

  def foo(*, x=None, y="")
(Edit) The specific slide: http://www.asmeurer.com/python3-presentation/slides.html#16

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

#23
post #12
post #8

Earlier quoted context omitted.

I don't expect to have to use my keyboard to navigate a webpage. It's also not discoverable or prompted in any way.

Using the arrows keys for the slides has been a standard since the dawn of web presentations, a decade or so ago. Doesn't have to be more discoverable imho. As soon one finds it out, they can use the knowledge for any other presentation they chance upon -- and presentations remain clutter free, without prompts and extra navigational buttons for the rest.

> Using the arrows keys for the slides has been a standard since the dawn of web presentations, a decade or so ago.

So have arrows icons you can click to switch slides... Such as on Slideshare (coincidentally a decade old!).

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

#24

Quite a nice presentation! But I just wanted to point out that the title is a bit presumptuous. I don't refuse to upgrade to Python 3, it's that the default Python for most distributions is 2 (sometimes as far back as 2.6). If you want to write a user-space tool with Python you can either require additional dependency setup, bundle a full interpreter with your package, or just write Python 2.7/6 code that is forward…

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

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

#26
post #4

I'm impressed how much Python seems stuck on older versions. What went wrong?

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…

`hex` and `fromhex` were added to the bytes type in Python 3.5.

And while it isn't trivial, it is easy enough to just deal with bytes in 3.x.

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

#27

The new keyword-only arguments look great, but it looks like it relies on adding a " * " parameter that allows any number of arguments. What if I want the safety of keyword-only arguments, but I don't want varargs? Is there a way to do that?

This is covered in the link. Just put a * without a name, as in def foo(*, x=None, y="") (Edit) The specific slide: http://www.asmeurer.com/python3-presentation/slides.html#16

Aha, thanks! I misunderstood -- I assumed the lone * would parse and discard any number of arguments.

This is a very good feature, but a weird syntax!

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

#28
post #4

I'm impressed how much Python seems stuck on older versions. What went wrong?

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…

I strongly disagree with respect to unicode changes. From my perspective, where 95% of my Python is Python3+Twisted implementing obscure and obtuse protocols, the strong firewall between byte strings and character strings plays a key role in my keeping my sanity. Unicode + byte strings alone are worth moving to Python3. I also make heavy use of other new features, I can't imagine going back to Python2.

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

#29
post #20

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

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.

Post reply on HN