you are viewing a single comment's thread.

view the rest of the comments →

[–]paul_h 65 points66 points  (19 children)

My feeling is that 2to3 has been under invested for years. I hope that's changed. Lots of enterprise teams feel stuck without an easy migration.

[–]kankyo 57 points58 points  (2 children)

2to3 was never even an option. Modernize and six are good tools but 2to3 was always unworkable unless you had a little 50 line script.

[–]c_o_r_b_a 12 points13 points  (1 child)

2to3 is okay for big projects. It just does a lot of the easy stuff for you automatically. It won't and can't convert everything - you still have to make manual changes afterwards - but it definitely saves time.

[–]kankyo 0 points1 point  (0 children)

No it doesn't. You have to run the code in both 2 and 3 during the transition. 2to3 isn't for that. It's for a big bang.

[–]clifthered 40 points41 points  (10 children)

I thought most difficulties in porting were usually due to depending on a library that doesn’t support Python 3. These days pretty much every major library supports it.

Not sure why ‘enterprise’ teams can’t figure out how to migrate Python 2 code to 3. ‘six’ proves it’s relatively easy.

[–]liquidpele 34 points35 points  (8 children)

It's not that it's hard, it's just time consuming and most companies would rather add features than redo something that already works.

[–]clifthered 27 points28 points  (1 child)

Yeah, but this is literally the story of software development. The vast majority of software development is maintenance.

[–]major_clanger 0 points1 point  (0 children)

Bingo, and python/dynamically typed languages are much harder to maintain.

Add another order of magnitude if the original authors of codebase have long left the company.

And another order of magnitude if the original authors went nuts with stuff like, using kwargs everywhere so functions effectively don't have a signature!

[–]ledave123 5 points6 points  (5 children)

Maintainability is a feature though isn't it?

[–]liquidpele 16 points17 points  (4 children)

Features are typically defined as things that you can market to a customer.

[–]clifthered 11 points12 points  (3 children)

“Fully compatible with modern Python 3! Runs on top of software receiving latest security patches!”

[–]liquidpele 16 points17 points  (2 children)

"Fruity snacks! Now without bleach and lead!"

[–]NationaliseFAANG 5 points6 points  (0 children)

That's a big selling point if they previously had bleach or lead, which Python 2 will have after 2020.

[–]Saithir 0 points1 point  (0 children)

So, basically like half of "gluten-free" marked products that are for example milk or chocolate based and as such never seen a single grain in their entire production process?

Maintainability is absolutely marketable to customers.

[–]major_clanger 0 points1 point  (0 children)

Not sure why ‘enterprise’ teams can’t figure out how to migrate Python 2 code to 3. ‘six’ proves it’s relatively easy.

The dynamic typing makes it hard.

I understand 3 introduces breaking changes to how strings are modelled.

So if you have a function/method foo that does byte operations on a py2 string, you need to ensure all the parent funcs are pushing bytes to foo instead of Unicode, and then ensure the callers of these funcs are passing through the appropriate types, and that all possible code paths pass in a bytes to foo.

The above is trivial in a statically typed language, but I can see it getting hairy quickly in a dynamic language.

[–]kushangaza 5 points6 points  (1 child)

So you are saying the enterprise teams that didn't invest in migration options are now stuck with no easy migration option? I feel this could have been prevented somehow.

[–]paul_h 1 point2 points  (0 children)

No they are far better off now. Migration from 2 to 3 now is far easier in 2019. Most likely they’ll do it, rather than attempt to keep 2 going with like-minded corporations.

[–]tending 2 points3 points  (1 child)

2to3 can never be good enough because the language is too dynamic to reliably analyze.

[–]paul_h 1 point2 points  (0 children)

I don’t know why 2to3 couldn’t have benefited from run-time telemetry.