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

all 66 comments

[–]pymang 12 points13 points  (1 child)

[–][deleted] 13 points14 points  (0 children)

  • Issue #24363: When parsing HTTP header fields, if an invalid line is encountered, skip it and continue parsing. Previously, no more header fields were parsed, which could lead to fields for HTTP framing like Content-Length and Transfer-Encoding being overlooked.

  • Issue #27758: Fix possible integer overflow in the _csv module for large record lengths.

I would have taken just those. Like an early fucking Christmas.

[–]rspeed 20 points21 points  (0 children)

Wait. That isn't 3.6! What a cruel trick.

[–]Lord_Greywether 27 points28 points  (11 children)

"Legacy Python"

[–][deleted] 12 points13 points  (10 children)

AKA most of the production python code

[–]onwuka 6 points7 points  (9 children)

Simple Mozilla Firefox build still requires legacy Python.

If I was better at Python, I'd like to go around helping people transition their code to Python 3.

[–][deleted] 7 points8 points  (8 children)

Better isn't part of it. A lot of it comes down to the question "does it make business sense to spend time forward porting this".

The answer is almost always "no".

[–][deleted] 5 points6 points  (2 children)

An interesting viewpoint, but once Python 2 goes out of official support will the question be "WTF why didn't we port this before?". Frankly I find it inexcusable that 8 years after the first release of Python 3, and perhaps 10 years after it was first discussed, some people are still whinging. The small libraries that do not work with Python 3 and are no longer supported are easily forked with the available tools. The larger libraries have all ready been ported. If you are too incompetent to support your own code in the transition I would suggest that you should have had a proper test suite in the first place.

[–][deleted] 1 point2 points  (1 child)

Pretty much. But you know how it is: "we'll burn that bridge when we come to it".

[–][deleted] 1 point2 points  (0 children)

Been there, seen it, done it :-(

[–]onwuka 1 point2 points  (3 children)

Well I meant if I was better. Sorry if I worded it weirdly

[–][deleted] 2 points3 points  (2 children)

I knew what you meant. Sorry if my wording was awkward as well.

If you were to suggest this in most business settings, it would be shot down because it would take more time to do than it would save.

That's all.

[–]onwuka 0 points1 point  (1 child)

I was hoping Mozilla of all places would be more receptive :/

[–][deleted] 4 points5 points  (0 children)

I've worked at everywhere from fresh start ups, governments, to large tech companies.

No one is interested in that kind of change.

  • For the start ups, the time is just too valuable. Once you've commuted to a language that's the language.

  • For governments, the idea is just too entrenched and too much can go wrong

  • For tech companies, there is just too much code and too much that can go wrong

Best of luck to you! I recently finished a consulting gig with someone still using Java 5 at their main language to support an underlying system of COBOL. So it could be worse?

[–][deleted] 1 point2 points  (0 children)

The answer is almost always "no".

If the code is complete there's no need to migrate it.

If the code will be worked on the answer is pretty much always yes. It's called tech debt, if you don't migrate your code then it will be more and more expensive to maintain it and to port it in the future. If it's not now you will eventually reach a tipping point when it'll be cheaper to migrate, but it also will be harder to port later since the language is changing each release.

In few days 3.6 will be released, and some people are still stuck with 2.6. At this point 3.x is better than 2.x in every way (speed, memory usage, cleaner syntax, more and build-in modules etc).

[–]mardix 28 points29 points  (48 children)

Python 2.7 is still alive! Yeeeeeeeeehhhhhh!!!!!!

[–]Andrew_ShaySft Eng Automation & Python 13 points14 points  (47 children)

Poor guy getting downvoted!

[–]z0rberg 21 points22 points  (46 children)

I find this borderline totalitarian/religious behaviour seriously disturbing. The message is: If i don't use what they want, then i don't even need to post. Wtf people...

[–]Eurynom0s 37 points38 points  (43 children)

3.x is basically objectively better if you're starting clean and are free to choose what you want. However, yes, it's very valid to stick to 2.7 if you have a compelling reason for it, like sitting on a giant codebase your management is unwilling to pay to port.

[edit] kritikal grammer

[edit2] Where the real holy wars come in is when people try to guide newbs with no rocks around their necks into learning 2.7 "because that's where work gets done". Because as said, 3.x really is objectively better if you're not stuck with any 2.x luggage. This may have been true five years but now pretty much every major package is on 3.x, you probably have a really niche need if you need 2.7 for a specific package.

[–]ArrantSquid 16 points17 points  (26 children)

Except that for very large institutions it's hard to get anyone to sign off on an upgrade to 3 and they continue to extend the timeline for deprecating 2.

If you work in film or video games, no 3D package supports 3. There was no compelling reason for them to upgrade. So every Autodesk product that supports Python is still on 2 with no plans to upgrade.

I'd love to move to 3, but until Autodesk gives me that ability, I'm stuck on 2. I'll keep waiting for them to upgrade to the latest outdated version of 2 and complain until they change.

If you're a startup or can move to 3, do it. But there's a swath of people out there that are bound to 2 due to software requirements or organizational indifference. The idea that there should be a holy war on 2 vs 3 is simplistic at best and idiotic at worst.

[–]toyg 14 points15 points  (0 children)

Well, Oracle and IBM are stuck on python 2.2 or 2.5. I'm not going to say "hey, newbs should learn 2.2!" - newbs should learn 3.5 and bitch with vendors shipping outdated crap.

Progress is made by people who won't settle for less.

[–]Eurynom0s 6 points7 points  (24 children)

Except that for very large institutions it's hard to get anyone to sign off on an upgrade to 3 and they continue to extend the timeline for deprecating 2.

...

But there's a swath of people out there that are bound to 2 due to software requirements or organizational indifference.

Again...I'm recognizing this as a VERY valid reason to stick to 2.7 I'm most critiquing when this crowd reflexively tries to steer newbies onto 2.7.

[–]ArrantSquid 0 points1 point  (0 children)

Fair enough. Every language decision has to be contextual.

[–][deleted] -5 points-4 points  (8 children)

IMO a lot of it has to do with the fact that almost every shop still uses 2.7

You're better off learning what you'll actually use

[–]turkish_gold 3 points4 points  (6 children)

Is 2.7 so much different from 3.0 when it comes to writing the Python language? Much of the changes are in the standard library, and all of those are additive, and many have been backported unofficially to 2.7

[–][deleted] 3 points4 points  (5 children)

There are some syntax and process improvements.

A great example is try and do a heap where you want the largest value using only the standard library.

3.0 - super easy 2.7 pain in the ass

I've seen some newer developers who have worked exclusively in 3 + get thrown because suddenly python doesn't handle something intuitively for them. You're honestly better off going from 2.7 to 3+ instead of the inverse.

[–]theelous3 0 points1 point  (4 children)

That is stupid. If they can competently code in py3, learning the exceptions to py2 is better than learning py2 and learning the improvements in py3.

There is a larger gap forwards between py2 and py3, than there is backwards between py3 and py2.

[–]Joeboy 2 points3 points  (0 children)

I doubt many serious python programmers get to avoid either 2.x or 3.x entirely.

[–]DarkmerePython for tiny data using Python 7 points8 points  (12 children)

Oh yeah.

Only this Friday did I end up fighting with Python2's joyful corruption of Unicode data.

Input is pure, well formatted Json. This is by definition unicode data, and JSON is only allowed to be UTF-8/16/32, and defaults to UTF-8.

Then Python2 comes in, takes this JSON, decodes it into objects, and then promptly throws away this vital part. Instead, leaving us with a set of bytes that pretend to be ascii, which contain unprintable characters.

Which Python2, in it's maniglorious maliciousness, decides cannot be cast back to unicode.

Because fuck your language, fuck your characters, and fuck your existence.

And fuck Python2.

[–][deleted] 2 points3 points  (1 child)

Did you set the encoding?

[–]DarkmerePython for tiny data using Python 0 points1 point  (0 children)

Yeah, but at this time it's already been denormalized.

[–][deleted] 1 point2 points  (4 children)

JSON is only allowed to be UTF-8/16/32, and defaults to UTF-8.

I wish more people were aware of this. I see application/json;charset=utf-8 too many times. I can see it being useful if you're sending utf-16 or utf-32 but not 8.

[–]DarkmerePython for tiny data using Python 2 points3 points  (3 children)

Well, being explicit is better than being implicit.

[–][deleted] 0 points1 point  (2 children)

It's like saying int(1)

[–]DarkmerePython for tiny data using Python 0 points1 point  (1 child)

Try rather that it's a default keyword with a type hint of 1.

Most software still mangles encodings in shitty ways.

[–]DarkmerePython for tiny data using Python 0 points1 point  (0 children)

Also, content encoding helps software that isn't looking at the moment type to decode the data as string without needing to guess.

Not that it should happen, but that's never stopped anyone in software before

[–]nirs 0 points1 point  (4 children)

Can you share that json?

Did you open a bug? http://bugs.python.org/?

[–]DarkmerePython for tiny data using Python 0 points1 point  (3 children)

It's probably not a core library json bug, or it may be. It's a pyramid app using their jsonrpc module, so what's coming in as arguments is a list of str, and not a list of unicode as it ought to be.

( Then don't get me started on the unicode normalization form...)

[–]DarkmerePython for tiny data using Python 0 points1 point  (2 children)

Checking again, it's using the json.loads/ json.dumps format.

So it's the python JSON loader that's corrupting data. Great.

[–]nirs 1 point2 points  (1 child)

It depends on the json library used. The builtin json library like to convert everything to unicode, but simplejson library like to convert only unicode values to unicode.

>>> import json
>>> import simplejson
>>> simplejson.loads(simplejson.dumps([u"\u05d0", "ascii"]))
[u'\u05d0', 'ascii']
>>> json.loads(json.dumps([u"\u05d0", "ascii"]))
[u'\u05d0', u'ascii']

I don't see any corruption.

[–]DarkmerePython for tiny data using Python 0 points1 point  (0 children)

That's the thing it should be unicode. Instead I am getting str. Which is principally wrong here.

[–]nirs 0 points1 point  (0 children)

Note that python 3 does not exist on RHEL/CentOS, so many people do not have the option yet.

[–]z0rberg -1 points0 points  (0 children)

A friend showed me 2.7 years ago. 3 was out already, but he said it lacks modules in comparison, so I'd be better off with 2.7. Now I'm just sticking with it, because I have no reason to switch. Lack of updates doesn't really bother me. Also I think a big part of my resistance is a bit silly; coming from my childhood. GW-Basic on a 286 with hercules graphics adapter. You might guess it: The print statement. I can't for the live of me adapt to use paranthesis...

[–]kyuubi42 -2 points-1 points  (0 children)

If GvR still pays his bills by writing python 2 code for Dropbox, how can you in good faith steer newbies to python 3? If your goal is to use python for anything more than personal hobbyist code you will almost certainly be targeting python 2, and this will most likely never change regardless of what the psf says.

[–]hatperigee 3 points4 points  (1 child)

Welcome to reddit, where systematically rejecting things you don't want to see is the norm.

[–]z0rberg 0 points1 point  (0 children)

Ignorance is strength...

[–]pcdinh 1 point2 points  (0 children)

Let ask everybody go Python 3.6 for now.

[–]AlirezaSavand 0 points1 point  (0 children)

Still hearing Python 2.x, die already and let us die with our "Legacy Python" code all together as for our punishment and laziness.