Live data from Hacker News

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

asmeurer.com

241–250 of 264 posts

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

#241
post #20

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

Yes. My reason is that I simply don't really care that much. It's the default on all my systems, so why bother putting in the effort to use something that doesn't appear to offer much advantage to me personally? I use python for my personal research, so my particularly situation affords me this laziness. edit: I don't mean this as a knock on py3. All I'm saying is that my situation and uses for python allow me to be…

> I use python for my personal research, so my particularly situation affords me this laziness.

I am pretty much in the same situation and in hindsight I kinda wish I upgraded a little sooner. Fixing print brackets was the biggest (not that big) task, and from there on it was all python3 sugar for me :)

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

#242
post #122

How old is Python 3 now? I've always used Python for a "miscellaneous task" language, and still do... and even I find "...because you refuse to upgrade" a bit insulting. If I used it for something serious, even more so. The way 2.x -> 3.x was handled is/was/will is an absolute disaster. Upgrading simple scripts is a non-issue. Larger projects seem to always be a horrible pain.

Python 3.0 was released on 2008-12-03. It actually become usable somewhere around 3.2/3.3, released in 2011/2012.

I think about it like:

- 2008-2012: Becoming actually usable.

- 2012-2016: Libraries porting over

- 2016-2020: Applications porting over (more work needs to be done here. See http://portingdb.xyz )

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

#243
post #223

Earlier quoted context omitted.

You're not. von Rossum has to maintain Python 2.7 as part of his day job. Things I still have in Python 2.7: - Code that runs on low-end shared hosting. There's a Python 3, but it's 3.2, the least-compatible version. No "six", and "u'xyz' isn't allowed. - ROS, the Robot Operating System. Python 3 support is coming, but it's not really here yet. I converted over the dedicated servers and some IoT stuff a year ago. The…

> You're not. von Rossum has to maintain Python 2.7 as part of his day job. *van Rossum I wouldn't say that's an accurate statement of what Guido does every day :) (nb: I work at Dropbox, and have worked with Guido at Dropbox.)

has to maintain _code_ _written_ _in_ Python 2.7 as part of his day job.

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

#244
post #20

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

Yes. My reason is that I simply don't really care that much. It's the default on all my systems, so why bother putting in the effort to use something that doesn't appear to offer much advantage to me personally? I use python for my personal research, so my particularly situation affords me this laziness. edit: I don't mean this as a knock on py3. All I'm saying is that my situation and uses for python allow me to be…

What system do you use? 2.x is installed by default on MacOS, but not Ubuntu 16.04.

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

#245
post #85

Earlier quoted context omitted.

I'm in similar situation wrt what I use python for, and suffered from the same apathy until quite recently. Man, it was really easy to switch, and completely worth it just for the little things (like UTF-8 as default encoding for strings). It's really painless, but if you want to ease into it, I recommend using __future__ in your py2 stuff for now just to get you into a py3 state of mind: https://docs.python.org/2/li…

UTF-8 isn't CPython's default encoding for strings. The internal encodings are ASCII, UTF-16, or UTF-32, depending on the widest character in the string. I would have made UTF-8 the internal representation, and generated an array of subscript indices only when someone random-accessed a string. If the string is being processed sequentially, as with for c in s : ... you don't need an index array. You don't need them fo…

I agree. Go does something similar (using UTF-8). The Go creators _invented_ UTF-8, so I trust them. :)

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

#246

Earlier quoted context omitted.

Installed by default.

As the GP said, Python3 is installed by default on any big distro for 5-10 years already. It's not the default because /bin/python is synlinked to python2. You have to explicitly run it.

> Python3 is installed by default on any big distro for 5-10 years already.

That's not very true.

- Most BSDs and MacOS still don't have it installed by default.

- RHEL/CentOS still don't have it installed by default.

- Ubuntu LTS didn't get it by default until 14.04. (3 years ago) (mainline ubuntu got it in 13.04, 4 years ago)

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

#247

Earlier quoted context omitted.

How hard would it have been to allow Python 2 and 3 code files to be mixed?

That’s a giant can of worms. One example problem: Python 2 has a type of class (old-style) that doesn’t exist in Python 3. What happens when you try to pass this type of class or one of its instances between the languages? There’s a bunch of stuff like that. You’d end up with a very weighed-down interpreter with a bunch of caveats if you ended up with one at all.

Oh man, I almost forgot about the old-style classes thing, haha :) That seems like ages ago (and it is ..)

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

#248

I'm not touching python like it was fire since it threw YouHaveAMissingTabSomewhereException at me 6 years ago. And it always pisses me off to see a python source code all lower case. Someone would think upper case letters cost money and underscores are a must like a lemon in a corona. Am I the only one?

Who can't touch fire? No ... ?

But yeah syntactic whitespace was a thing to get used to for myself over 10 years ago as well. It's no big deal and it works great (imho).

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

#249
post #223

Earlier quoted context omitted.

You're not. von Rossum has to maintain Python 2.7 as part of his day job. Things I still have in Python 2.7: - Code that runs on low-end shared hosting. There's a Python 3, but it's 3.2, the least-compatible version. No "six", and "u'xyz' isn't allowed. - ROS, the Robot Operating System. Python 3 support is coming, but it's not really here yet. I converted over the dedicated servers and some IoT stuff a year ago. The…

> You're not. von Rossum has to maintain Python 2.7 as part of his day job. *van Rossum I wouldn't say that's an accurate statement of what Guido does every day :) (nb: I work at Dropbox, and have worked with Guido at Dropbox.)

s/van/Van/

From https://gvanrossum.github.io/ :

But when my last name is used alone to refer to me, it is capitalized, for example: "As usual, Van Rossum was right."

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

#250
post #63
post #61

Earlier quoted context omitted.

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.

That is only relevant if there is no significant professional Python 3.x development taking place. There is, in fact, significant 3.x development taking place, and that number is growing - exactly as one would expect.

And by significant, I mean upwards of 40%. So, except for corporate inertia, or the rare can't-live-without libraries that have yet to be ported to 3.x (see: http://py3readiness.org), there are no compelling reasons to stick with Python 2.x for new projects.

Post reply on HN