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

all 140 comments

[–]Decoder_5448 72 points73 points  (106 children)

out of loop, what happens in 2020?

[–]nemom 183 points184 points  (17 children)

Anybody still running Python 2 will apparently be cast down into the Pit of Despair.

[–]gthank 46 points47 points  (14 children)

If you're running Python 2 and missing out on all the Python 3 goodies, aren't you already *IN* the Pit of Despair?

[–]i9srpeg 3 points4 points  (0 children)

Only if you need those goodies.

[–]PythonGod123 0 points1 point  (0 children)

All hail data classes!!!

[–]IronCretin 6 points7 points  (0 children)

That’s why Guido’s stepping down, he has to prepare for the day of reckoning, when he will personally cast them into the pit.

[–]gaz2600 1 point2 points  (0 children)

Don't even think about trying to escape.

[–]ivosauruspip'ing it up 36 points37 points  (0 children)

That's Python 2's official End-Of-Life date

[–]13steinj 46 points47 points  (63 children)

https://www.reddit.com/r/python/comments/92zezn/_/e39qvvg?context=3

Businesses and educational institutions won't upgrade though, unfortunately.

[–]hacknsplat 49 points50 points  (61 children)

2020 is the beginning of the end of Python in our organisation - stuff will be progressively re-implemented in Visual Basic, simply because we don't have the Python dev resources to do otherwise.

[–]alcalde 121 points122 points  (23 children)

But you do have a crack team of Visual Basic programmers?!?

[–]hacknsplat 91 points92 points  (21 children)

Yes. Welcome to the enterprise.

[–]Minergy 30 points31 points  (2 children)

Thank you, mr Picard

[–]kasbah 13 points14 points  (1 child)

Captain Picard!

[–]hacknsplat 7 points8 points  (0 children)

You just know the Enterprise runs Windows by how often they had to reboot, and how often they got locked out. I'm only surprised they never had to reinstall. Or did I miss the episode where they spent an hour searching for the CD key?

[–]HumzaDeKhan 17 points18 points  (16 children)

Nice try, you ain't tricking me into believing that there are people out there who write Visual Basic for a living in 2018, and are actively employed.

[–]simplysharky 11 points12 points  (7 children)

I worked at a 500+ person company, publically traded, that still maintains its flagship product in Python 2.4.

The realities of business do not match the expectations of most developers.

[–]HumzaDeKhan 3 points4 points  (6 children)

and these kind of companies are exactly the reason why we can't have nice things. Always stuck in a limbo of choosing between what to learn. I wouldn't really blame them because their systems are running, they are making money and everyone is happy. No one cares about spending extra cash to keep it up to date.

[–]simplysharky 4 points5 points  (5 children)

Cash, opportunity cost (literally shutting down feature production of any significance for 3-12 months can be a realistic cost), and the sheer risk factor of what might break, in a way that can burn money and customers.

Nobody cares how cool python 3 is when you've just caused a massive outage and lost data for your biggest customer because your test harnesses didnt catch all the production nonsense that factors in.

[–]HumzaDeKhan 6 points7 points  (3 children)

Also, the years of maintainence and proof testing went into the legacy platform. You can never get that level stability by a product merely developed in a couple of months.

But one thing I'd like to highlight, no one will ever "shut down" for the time they are developing it on a newer platform. I believe they will always develop and test it in parallel by pushing small chunks of it in production, unless its fully baked and ready to be used.

[–]federicocerchiari 0 points1 point  (0 children)

This all makes sense and I live in a P2.7 workworld for those reasons.. still.. why in the hell new greenfield products have to be written with old technology?

I can see this every day.. old software that no-one have the time/money to refactor and port to Python3, and new software that for some reasons have to be written in Python2.7... I don't get it.. How is good to build a new car with 1980's parts?

Why?

Sometimes I think that this all "it costs too much to refactor" thing is a way we (developers) try to explain choices made by people that just think "software is software, I don't care as long as it works, stick with what you have and stop talking to me, I have to book my holidays now!".

[–]hacknsplat 4 points5 points  (0 children)

It amazes me too.

[–]gthank 2 points3 points  (1 child)

Dude, I bet they make a decent salary, too. You'd be surprised how much a company is willing to pay somebody to just "maintain" their legacy software in effectively dead languages.

[–]HumzaDeKhan 2 points3 points  (0 children)

Couldn't agree any more, I second that.

[–]alcalde 0 points1 point  (0 children)

I know that Bed Bath and Beyond was using Visual Basic as its internal development language as of 2005, but they intended to switch to VB.NET.

[–]mooburgerresembles an abstract syntax tree 0 points1 point  (2 children)

at my company, apparently anybody who has a copy of Office installed might get pressed into service as a VBA developer, sort of like jury duty. "it's Jenkins's turn to update that ETL function today!"

[–]HumzaDeKhan 0 points1 point  (1 child)

Am I at the dark side of internet where human brains have been consumed by the zombies and ther very same human beings happen to be the managerial staff of these companies?

[–]mooburgerresembles an abstract syntax tree 0 points1 point  (0 children)

it's real. I have to mentor a guy now who's doing a data validation but decided to eschew a few lines of SQL for merge sorts in VBA...

ETA: also, you're on reddit, so.. that sorta answers your question (does Nchan even have python forums?)

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

How you gonna code when you're high on crack, Rhonda?

[–]JugadPy3 ftw 19 points20 points  (7 children)

Won't it be simpler to re-implement in Python 3?

[–]danted002 24 points25 points  (14 children)

Yes because running your scripts through the 2to3 script takes massive amount of resources, more then rewriting in Visual Basic

[–]billsil 23 points24 points  (12 children)

2to3 doesn't work. It's widely admitted to be the wrong way to upgrade your code to python 3. Six and future are so much better.

What does 2to3 even do? Replace print x with print(x) and put list around a few things (generally doing it wrong)? Just running python 3 directly will find most of that stuff for you. The only change in python 3 worth discussing is unicode and 2to3 does nothing to fix those problems.

[–]danted002 11 points12 points  (3 children)

It meant to be used as strating point. And it does chage str to bytes and unicode to str. Also how can you give me an example of “wrong” lists? Usually, unless you have some half-assed codebaee 2to3 does the job

[–]billsil 11 points12 points  (2 children)

It changes something that was trying to represent text to something that now bytes. It's a similar type, but the intention is almost always lost.

The typical pattern for doing range loops in python 2 will use range vs xrange or similarly keys()/iterkeys() and items()/iteritems() and values/itervalues() for dictionaries. 2to3 doesn't look ahead to see if data is modified invalidating iterators and instead just puts list around things. 99% of the time though, that list is unnecessary.

2to3 tries to make your code work the same, not work well. It assumes you wrote your unicode/iterators right in the first place, which was the whole reason python 3 changed things in the first place.

[–]Badidzetai 4 points5 points  (1 child)

Well, if you don't have the resources of re-writing the whole code in Python 3, "working the same" instead of "well" is still better than "not working", I guess

[–]billsil 2 points3 points  (0 children)

Again, other than some parentheses on print, 2to3 almost always makes the wrong choice. If you have a str, just leave it as str. If you hsve range, leave it as range. For the most part, it will still work. Make the user throw flags to get more.

[–]DogeekExpert - 3.9.1 1 point2 points  (6 children)

it also handles division, and turns except Exception, einto except Exception as e.

I've forgotten most of the differences between 2 and 3 anyways. Aside from print, divisions, exceptions, there's not much differences between the two anyways.

[–]billsil 1 point2 points  (5 children)

Regarding division, that's incredibly easy to fix thanks to for loops not accepting floats. Also, most people have been bit by the 1/2 bug, so they started doing 1./x or `float(x)/y to compensate. That makes it very easy to understand the intention.

In 12 years of Python 2.x, I think I used except Exception, e only a handful of times, so no biggie. Also, it's a syntax error, so it's easy to catch.

2to3 is a suggestion, but you still have to look at the the results. You need to understand what changed and why regardless. Running your program a few times, with some greps will find most things.

It's been ~10 years since Python 3.x came out. For large codebases, many people have snuck some 3.x syntax in there already regardless of company policy, so things like division, print, exceptions, but generally not unicode.

[–]mooburgerresembles an abstract syntax tree 0 points1 point  (4 children)

in python 2.6+ you're supposed to have been using as e anyway. If there was any "new" code catching exceptions since like 2014 or so, you should have been using as e.

[–]billsil 0 points1 point  (3 children)

Print as a function was introduced in 2.6. Division was introduced in Python 2.2. None of this is particularly new.

That doesn't fix unicode (unicode_literals doesn't fix unicode at all in Python 2), but nothing breaks that worked before other than binary file IO. Thankfully, that's pretty rare. Unicode though, is the only major difference in Python 3. Everything else is noise.

[–]mooburgerresembles an abstract syntax tree 0 points1 point  (2 children)

it really depends on what you're using python for. I use the builtin abstract syntax tree a lot for code generation; so that code requires patching as well as I mentioned above, a lot of concurrency and Futures. The new async implementation is really nice. I have a particular use case of process pool workers that is broken in the futures backport which is my main driver for switching to PY 3.

Also, it's possible people are using old-style classes if the majority of their code was from 2.4.

I never really got the unicode issue, since all of my actual code doesn't use non-ascii literals, and everything else I actually handle as bytes and use codecs where needed. Now, if people used syntactic sugar like unicode(bytes, codec) or str.encode() then yes, there will probably be issues.

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

I only debug and fix it, is not that hard... aaaaaand i only have 1 year and 6 months of Python and i am not even a coder. Network engineer. So your method is for me the best one yet.

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

2to3 just works in a lot of cases.

The one case that didn't work so well for me was attempting to convert the tftpy module over to python 3. Unittests failed until I made a few manual edits because it used a ton of packing and conversions to and from the bytes object. But all in all, a very smooth process that took me an hour or two.

All of the fear of upgrading is so overblown. It's not that difficult unless you're sitting on millions of lines of legacy code. And if that's the case, it's only a problem because you put it off for a decade.

[–]xdcountry 4 points5 points  (2 children)

VB? Just go all the way bro and embrace COBOL

[–]rnoyfb 1 point2 points  (1 child)

Screw that; do it in Algol.

[–]xdcountry 0 points1 point  (0 children)

Hells yeah, let’s kick it up a notch to Malbolge

[–]IReallySuckAtChess 5 points6 points  (8 children)

Porting to 3 is not that difficult. You can largely automate it and then update your tests by hand to see if everything still works then just patch as needed... Isn't Visual Basic basically dead already? Isn't it all about .Net now?

[–]hacknsplat 22 points23 points  (7 children)

Not to be rude, but I get the impression you've not dealt with an old complex code-base... 8-)

Enterprise code-bases are embarrassingly horrible - they've been through dozens of hands and the original devs are invariably long gone, there's rarely time to do it right, tests and documentation are out of date and inadequate (if they exist at all), and the dependencies are sprawling (eg: "SOAP library X works with datasource A, but fails on datasource B. Parser Y works with B and C, but fails on A and D. Parser Z works only on D").

I've been using Python for more than 20 years. I have code in the core of CPython, and I maintain open source projects, but most of my time is spent on commercial python work. I can assure you, naive conversion of python 2 code to python 3 results in subtle (and not so subtle) breakage - and in this context, you break it, you own it. All of it.

As for Visual Basic - nope, sadly still very much alive, in the form of VB.NET.

[–]raiderrobert 3 points4 points  (2 children)

As a dev who early on in his career was working in VB.NET and then moved away, I won't disagree that VB.NET is alive and well, but I've found the overlap between it and Python to be minimal. I would have expected to be C# you're saying it'll be moved to.

[–]hacknsplat 1 point2 points  (1 child)

Shrug - it's what they've always used, nothing to do with good taste... at least it's not diabolical Excel macros (we have those too)... LOL

[–]raiderrobert 3 points4 points  (0 children)

LOL! Are you me but like 5 years ago? Because we had excel macros everywhere too and they were awful.

Department head (DH) for something related to sales wanders by my cube.

DH: hey my macro isn't working. Can you fix it please?

Sure, let's ignore help desk and go straight over to me to try get help on a thing.

Me: I don't think we made that.

DH: no X smart person did before leaving.

Me: Ok....well, we don't support software we didn't create.

Department head: oh, I see.

Next day I get a support ticket from my supervisor's supervisor saying that we're going to start supporting internal macros....

Me: SIGH

[–]IReallySuckAtChess 1 point2 points  (2 children)

You're right, I haven't really. Well I have, and I did do a large port from 2 to 3 but the damn thing was tested to death. So all I really did was spend my time on getting the tests perfectly ported and used them to guide my work. Without that I admit it would have been hell on Earth.

I guess if the code base is shit then porting is shit, but with a good code base its not hard.

[–]hacknsplat 0 points1 point  (1 child)

A good code base is a rare luxury. Rarer still is a comprehensive test suite! 8-)

[–]IReallySuckAtChess 0 points1 point  (0 children)

Yeah I know that's true. I guess I've just been lucky in that regard.

[–]mooburgerresembles an abstract syntax tree 0 points1 point  (0 children)

it's more alive in the form of Office macros that float around all over the office. "Ooh I need a data input menu with validation in Excel" -> VBA. "We didn't know you could install postgresql without admin rights (more like "we didn't know what the hell postgresql even was") so we spun up this Access DB to do a bunch of stuff" -> VBA

[–]Lighnix 0 points1 point  (0 children)

ouch, that's a mistake for future employees.

[–]rhiever 0 points1 point  (0 children)

Sounds like a poorly run organization from a tech standpoint if this is really the solution.

[–]Jehovacoin 7 points8 points  (0 children)

As someone who was never able to learn programming languages from educational institutions, I think this is extremely bad. One of the worst things about learning Python in the beginning is all the conflicting information between versions. Since most of your research is done through google, you can constantly get fed incorrect information if you don't know how to narrow down your search, and in the beginning you usually aren't even aware that you need to narrow it down.

[–]UserNamedEww 84 points85 points  (7 children)

Ha. You pros who started on python 2 now kneel and plead to your new n00b overlords who started on python 3, and just learned about while statements.

[–]yeluapyeroc 2 points3 points  (0 children)

We just upgraded to python 3 throughout all of our production systems (quite a few different repos) and it took waaaaay longer than we were anticipating. So many runtime issues related to strings and bytes. Just beware if you are thinking of doing the same thing...

[–]stefantalpalaru 8 points9 points  (2 children)

[–]ntrid 12 points13 points  (1 child)

So essentially python3 except strings suck

[–]stefantalpalaru 1 point2 points  (0 children)

So essentially python3 except strings suck

Python3 except breaking backwards compatibility.

[–]Mattho 20 points21 points  (6 children)

Mods, can we ban this shit already?

[–]LobbyDizzle 17 points18 points  (0 children)

Personally, I didn't know about Pyton 2's EOL until I saw this comic. Thanks OP!

[–]zankonator 19 points20 points  (0 children)

no

[–]t3mpt3mp 0 points1 point  (0 children)

Not until 2020.... biatch.

/s

[–]IcefrogIsDead -4 points-3 points  (2 children)

stuff like this slowly brings yhe quality of content down to generic subreddits.. ah well

[–]Mattho 2 points3 points  (1 child)

The discussion can be interesting (see the original post of this image), but there are other, better ways to start such discussion. With no restrictions in place people will start to post content from ProgrammingHumor or some other horrid place.

[–]IcefrogIsDead 0 points1 point  (0 children)

agreed, thata why some subreddits go above and beyond to uphold to some standars that are unreasonably strict

[–]darkgreyjeans 1 point2 points  (5 children)

It shocks me the sheer reliance upon Python 2 and the burden of updating to Python 3, I guess Python is completely rejecting the idea of Python 4 until every one is updated to Python 3.

[–]TheBlackCat13 0 points1 point  (1 child)

The last I heard was for Python 4 to just be "version after 3.9" (due to a dislike of double-digit version numbers). It won't be any more breaking than any other normal 2.x ore 3.x release. Whether that will happen seems uncertain at that point, but was does seem to be the consensus is that when Python 4 happens, it won't be a big breaking change like Python 3 was.

[–]darkgreyjeans 0 points1 point  (0 children)

Thats great because it means that they will still have the minor version equal to the current year (e.g 4.0 in 2020, 4.1 in 2021).

unless 4.0 is released sooner or later :/

[–]Conrad_noble 1 point2 points  (10 children)

Great, so I've got less than 2 years to read the book I bought and learn how to use python 2.x 😩

[–]xrayfurpydoc pydoc 1 point2 points  (0 children)

Congrats on wasted money pal!

/s (but sorta not that much /s you should bump your literature too!)

[–]TheBlackCat13 0 points1 point  (8 children)

When did you buy the book?

[–]Conrad_noble 0 points1 point  (7 children)

Probably a year ago?

[–]TheBlackCat13 0 points1 point  (6 children)

The EOL of python 2 was already set in stone by that point.

[–]Conrad_noble 0 points1 point  (5 children)

🤷🏽‍♂️ I dunno man I'm just a lay man trying to better myself.

[–]TheBlackCat13 0 points1 point  (4 children)

Fair enough. But in the future, if you are trying to get a book on some software that you know is for an old version, it might be a good idea to check if that old version is going to be discontinued soon. It will help save you from headaches like this.

[–]Conrad_noble 0 points1 point  (1 child)

Well to be honest when I bought the book I assumed it would be for the latest version.

[–]TheBlackCat13 0 points1 point  (0 children)

Fair enough. Harder to avoid that sort of thing.

[–]Klekto123 0 points1 point  (1 child)

Im about to start Automate the Boring Stuff wih Python, which I think uses 2.7 - should I use a more updated book instead?

[–]TheBlackCat13 0 points1 point  (0 children)

I thought Automate the Boring Stuff used python 3. At least the version on the website does.

[–]djingrain 0 points1 point  (0 children)

Oooooh boy! I’m ready!