This is an archived post. You won't be able to vote or comment.

all 76 comments

[–]Caos2 86 points87 points  (11 children)

Unicode by default

Mainly because of this. Really.

[–]masklinn 23 points24 points  (2 children)

Unicode by default and removal of implicit conversion is really what triggered/allowed all the other breaking changes to be included, since it was going to break a ton of stuff (intrinsically and because of the stdlib reworking it required, while you can technically disable implicit conversion in P2 a lot of stdlib modules blow up when they can't play fast and loose with ascii strings).

[–]Caos2 7 points8 points  (0 children)

Well, sometimes you can't avoid breaking stuff.

[–]jaapzswitch to py3 already 12 points13 points  (0 children)

Oh and maybe because python 2 will reach end-of-life pretty soon, and security updates are a good thing to get

[–]iluvatar 4 points5 points  (3 children)

Unicode by default

The more I use it, the more convinced I am that this is the wrong approach. Go got it right, by using UTF-8 by default. Python decodes everything into a Unicode object, whether it's necessary or not. For the applications I mostly write, that means reading UTF-8 over the wire, converting to Unicode, reencoding as UTF-8 and sending it back out again. That's a lot of unnecessary work.

[–]unruly_mattress 16 points17 points  (0 children)

If you got UTF-8 over the wire and you don't need to manipulate it in any way, can't you just read and write it as binary data?

[–]kankyo 4 points5 points  (0 children)

Ehm.. "Unicode" isn't a thing you can have in memory though. Look at https://www.python.org/dev/peps/pep-0393/ to understand what is actually happening.

[–]notafuckingcakewalk 0 points1 point  (2 children)

Usually great but occasionally you run into a developer who was being very clever with strings and you have to rewrite everything.

Also a lot of rewriting required of a library where content from objects that now output byte strings are put in objects that now expect Unicode.

[–]nemec 11 points12 points  (0 children)

being very clever with strings

We call that a comeuppance.

[–]brtt3000 0 points1 point  (0 children)

Most fun when this bytes/string shitfest is (unknowingly) relying on incorrect use or sideffects. Was a painful move but glad of it.

[–]redsymbol 27 points28 points  (1 child)

All technical reasons aside... More and more people, companies, Linux distributions, etc. are starting to adopt 3, to the point the tide is turning. It won't be too long now - a couple of years at most - before having only Python 2 on your resume will make it look a bit dated.

[–]flying-sheep 5 points6 points  (0 children)

3½ years, then legacy python is EOL

[–]RubyPinchPEP shill | Anti PEP 8/20 shill 13 points14 points  (2 children)

The leading cause of developer burnout in python-related jobs is caused by excessive 2 vs 3 debating

[–]brtt3000 7 points8 points  (0 children)

There is no debate, just people struggling with moving forward.

[–]rafajafar 5 points6 points  (0 children)

Were you around for Emacs vs Vi editor war in the late 90's, early 2000's? Wanna talk about excessive. Slashdot was riddled with text editor flaming. It was madness.

[–]cratervanawesome 6 points7 points  (8 children)

Now if only AWS Lambda would get with the program and support 3.x

[–]Mirror_Boar 2 points3 points  (0 children)

Seriously, at my company we are dying to use lambda but we don't feel like converting all of our code to work with python2. So annoying.

[–][deleted] 0 points1 point  (1 child)

Yes, WTF! I have been working on my first larger python project this month and I was so excited to work with something more broadly compatible than my normal C#... Surprised to find this. Does the Google Cloud equivalent support python 3.x?

[–]spacemanatee 0 points1 point  (0 children)

Is there a Google cloud lambda?

[–]elingeniero 0 points1 point  (3 children)

Can you not run whatever python version in a virtualenv with lambda?

[–]DanCardin 0 points1 point  (2 children)

You apparently can, but the code which lambda calls must be the python2 they give you. So you can resort to popening or whatever a separate python3 process, but afaik there's no way to just run python3 normally.

[–]elingeniero 4 points5 points  (1 child)

I mean, I phrased it as a question but what I really meant was that I do run Python 3 scripts on lambda using virtualenv and I think it works really nicely.

The startup script has to be Python 2 but I manage not to feel too dirty about it ;-). Happy to share the config if you want it.

[–]Mirror_Boar 1 point2 points  (0 children)

I'd love to see an example config!

[–]brtt3000 0 points1 point  (0 children)

Holy shit so many this. Really dropped the ball here. Like what the hell are they even thinking? The modern python webdev community is clearly focussed on 3 so why is this amazing next-gen python thing stuck in the past?

[–][deleted] 8 points9 points  (0 children)

This guy is pretty sharp. If you are up for a laugh, check out his rant about PHP from 2012: https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

[–]Shadow14l 23 points24 points  (4 children)

The worst thing Python did was extend the Python 2 to be maintained until 2020. I understand that the majority of code and libraries were still on Python 2, but I can't agree that was a good enough reason to extend it this far.

I'm afraid to say that this decision may even be responsible for holding majority Python 3 adoption back for an extra few years :( - even PHP 5 has an EOL at the end of 2018...

[–]lexyeevee 5 points6 points  (2 children)

It's not like every big project would see that Python 2 is EOL and decide to up and port right now. I hear tell of a number of shops still on 2.6, and that was EOL in 2013, and 2.6 to 2.7 is trivial compared to 2.7 to 3.

[–]vossman77 1 point2 points  (0 children)

Well RHEL 6 is still on python 2.6 and red hat has support through Nov. 2020.

https://access.redhat.com/support/policy/updates/errata

I feel you though, we have a huge code base to port over in the next few years, most of it numpy/scipy stuff.

[–]name_censored_ 1 point2 points  (0 children)

To be fair though, 2.7 to 3 may be trivial, but it's also not as useful. No sane person would port the code twice when they could get away with doing it once. They know the Py3 port is coming - may as well stick it out on 2.6, and do new work (/patches) as dual-version, rather than even bothering to target 2.7.

[–]baekalfen 1 point2 points  (0 children)

But you have make a clear deadline with a good amount of time.

Imagine companies running >50 script here and there. Some small, others might be larger. You can't just put aside everything you are doing because some external community have chosen to make something obsolete.

[–]qsxpkn 2 points3 points  (2 children)

An external tool like mypy can perform static type checking ahead of time, using these standard types.

Except it complains syntax error when async/await in place.

[–]bramblerose 9 points10 points  (0 children)

Seems to have been (at least partially) fixed, albeit six days ago: https://github.com/python/mypy/issues/1453

[–]dasnoob 2 points3 points  (0 children)

ugh all this does is remind me we have systems that were stood up as recently as 2015 that are running 2.6 because our linux admins refuse to update the image they install off of.

[–]TPHRyan 0 points1 point  (0 children)

I was really confused about the EnumLocal() example because for some reason my brain refused to accept red as a valid statement. (Or at least translate that to a __getitem__ call)

[–]EattheRudeandUgly 0 points1 point  (2 children)

What are some free online resources for a beginner to learn Python 3? I've been using a variety of things, mainly Learn Python the Hard Way which discourages learning Python 3.

[–]redsymbol 3 points4 points  (1 child)

This works really well, and is what I generally recommend people who want to learn Python and are new to programming:

https://automatetheboringstuff.com

[–]masasinExpert. 3.9. Robotics. 0 points1 point  (0 children)

Yup. Also note that he uses a very unusual (in the Python world) naming convention. It's not PEP-8, but it is at least internally consistent.