r/Python Pythonista 6d ago

News The Move to Python 3 Begins!

As someone who spent decades in the mainframe community, I find it ... humorous ... that there are legacy Python2 code bases that are only just (or have yet to consider!) moving to Python3.

https://www.eveonline.com/news/view/the-move-to-python-3-begins

302 Upvotes

106 comments sorted by

View all comments

4

u/iluvatar 6d ago edited 5d ago

As CTO at my previous company, I had to veto developers who wanted to migrate from Python 2 to Python 3. The amount of effort required for the migration and the fairly low chance of a trouble free switch just didn't make a good business case for a working codebase that brought in millions in revenue each year and paid all of our salaries. All new development was in Python 3. But existing running code just had too high a risk and too low a reward for migrating.

7

u/sirfz 6d ago

We did the migration 5-6 years ago and it was surprisingly much easier than I thought especially with the help of tools like 2to3 and future/past. Of course everything needed to be tested for correctness but it was definitely the right thing to do at the time. 

16

u/kosz85 6d ago

That's also not a solution. Now the missing new SSL support, old buggy libs, missing new formats, new docker images, removed docs, etc. Probably worse problem. You won't run from your tech debt storing it at closet behind your back and telling yourself that you don't see problem. It will smash you eventually as it grows in places you would not think of. The solution is to have really good tests (on multiple levels) and split problem in small chunks. Then migrate the small parts instead of colossus. I migrated many really big code bases, millions of lines, and seen real nightmares. Not looking is not a solution. Good tests before migration is.

3

u/SheriffRoscoe Pythonista 6d ago

Amen.

Nice userid, too.

3

u/will_r3ddit_4_food 6d ago

You really ought to migrate. Old code that doesn't get security updates is a bad risk

2

u/drakhan2002 4d ago

If it's within the risk appetite of the organization and they are willing to accept that level of risk, then it's the decision.

It may not be a popular opinion in the larger community, but it is not their org.

1

u/LungeloSLX 6d ago

Earlier on in Python 3’s life, this move was unnecessarily risky. But now staying on Python 2 is the more risky option. The lack of security updates, buggy libs that are no longer getting fixed

Good CTOs made the call to stay on 2 and stuck with it. Great CTOs found a way to make the migration and keep the business going

2

u/iluvatar 5d ago

The perfect example of "tell you you've never run an IT department without telling me you've never run an IT department". It is absolutely not the more risky option. Are there some cases where it might be? Yes. Ours was not one of them.

2

u/LungeloSLX 5d ago

Whether I ran an IT department or not doesn’t matter. There’s good and there’s great and I know which one you are

0

u/iluvatar 4d ago

Ha ha. You have nowhere near enough information to be making that sort of assessment.

1

u/HugeCannoli 5d ago

The result of this attitude is that you won't be able to hire anybody anymore, and people will leave because you are literally destroying their chance for re-employment in a different company.

1

u/iluvatar 5d ago

I'm employed to manage the IT of the company, not to enhance the future employment prospects of our employees. But your argument is flawed anyway because the majority of the code was in python 3. It's just that there wasn't the business case to justify porting the legacy application.

2

u/HugeCannoli 5d ago

I'm employed to manage the IT of the company, not to enhance the future employment prospects of our employees

And that's why they will leave you. Because you don't respect them. Let me guess, you are american?

1

u/iluvatar 5d ago

Because you don't respect them.

Incorrect.

Let me guess, you are american?

Also incorrect.

0

u/HugeCannoli 5d ago

well it certainly looks like both are correct.

0

u/GAZ082 4d ago

Software lives in a business. You have your free time to work in your pet projects that you can port from Python to rust and back if you want. If you don't like the company, just leave.

2

u/HugeCannoli 4d ago

we do, because again: if I have to spend years working with your crappy, obsolete code, my CV is compromised and I won't find employment when your business decides to "reassess the current resource allocation" and "curtail expenses by reducing the human budget".

Either keep up, or lose your employees (and good luck hiring new ones).

0

u/big-papito 6d ago

I feel like big refactors like this are ideal for a clanker like Claude. Manual migration, sure - no fun there.

2

u/iluvatar 6d ago

You're missing the point. The migration itself isn't the problem. Ensuring that the python3 code behaves in the same way as the old python2 code and doesn't have strange edge cases that throw away all of your money? That's much, much harder and takes orders of magnitude more effort than the basic 2 to 3 migration.

1

u/kosz85 6d ago

Yep, now we have such tools, but this is quite new and recent approach. In my times we had to... ;) But if this code is that much critical, I wouldn't dare to leave it to AI only. Also there is a case of context size. We speak about really big codebase. And sometimes knowing how it inter connects, and why is what ai is lacking in reasoning.

0

u/realPanditJi 6d ago

Same. In my prev org we tried to move from 2to3 along with django 1.4 to 4.X
We were able to get somewhat stable local build, and as we ran regression on it - everything fell apart. We never went ahead after that.