Live data from Hacker News

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

asmeurer.com

61–70 of 264 posts

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

#61
post #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.

That's also a meaningless argument. It's true of any turing-complete language.

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

#63
post #61
post #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.

That's also a meaningless argument. It's true of any turing-complete language.

> "That's also a meaningless argument. It's true of any turing-complete language."

Title 1 of course. Title 2 is a far more compelling reason to stay with Python 2.x. If I program for fun, then Python 3 is definitely worth playing around in, but for professional development, everything I do in Python is done in Python 2.x. That is not a theoretical argument, that is fact.

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

#64
post #62

Just wondering but what should you do if you decide to go with Python 3 and find a library you want to use that isn't compatible and you are short on time?

At this point in time, if you want to use a library and it isn't compatible with py3, then you probably shouldn't use that library. Essentially all actively maintained libraries are converted, and we are even starting to see libs that do not support py2.

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

#65
post #62

Just wondering but what should you do if you decide to go with Python 3 and find a library you want to use that isn't compatible and you are short on time?

That fear held me back 7 years ago when I started learning Python. In 2017, having worked in many projects, what I have to tell you is this: I never found such case where Python 3 wasn't supported, and I should've learned Py3 to begin with. YMMV, but the fear was unfounded back in 2010, and even more so today.

There are very few projects without Py3 support, and most you'll find without Py3 support is because the project has been dead for quite some time.

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

#66
I did not know you could append to a Path via "/", but that's really awesome! I also really love working with generators when I write Python. They are just such a simple idea that's very powerful and I miss them so much when I go back to javascript (I know javascript has them now, but I haven't written them, and they don't look as fluent as Python 3, where the large parts of the language design is based around them).

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

#67
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…

> 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 the notion that Python invented the idea of breaking changes, but it just isn't so.

[1]: https://stackoverflow.com/questions/6399615/what-breaking-ch...

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

#68

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

Oh my, it looks atrocious.

Almost every time I see something introduced in Python 3 I have an impression that current Python envies Perl its baroque semantics, except that Perl usually tries to guess what the programmer meant, while with Python the relationship is reversed: the programmer needs to guess what the language wants.

Python's main selling point was simplicity of syntax and semantics that preserved its high-level language status. This simplicity is no longer present in 3.x line.

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

#70
post #40

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…

Most Python 2 codebases probably have a lot of unknown bugs in them related to Unicode. The code will work fine for cases where the inputs are ASCII, but will subtly break if unicode inputs are provided. In term's of code reliability, Python 3's approach is much more sane.

I work at a company that uses Python 2 in older projects and Python 3 in newer projects, and this 100% matches my experience. Python 2's string implementation is simply busted, and the benefit you get in exchange for that brokenness is that some cases are slightly shorter to write.
Post reply on HN