r/programming • • Aug 20 '20

Announcing TypeScript 4.0

https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/
1.3k Upvotes

236 comments sorted by

View all comments

Show parent comments

21

u/Kinglink Aug 20 '20

Don't ruin this for me.... Damn.

In all seriousness, I had to convert a script from python 2 to 3... it took 3 line changes adding braces around print statements. I wonder what percentage of legacy Python 2 is a 30 minute code review away from python 3 compliance. It's not 100 percent, but I wouldn't be surprised if it was around a half.

10

u/0x202020 Aug 21 '20

Going through a 2->3 migration now... the problem we have is a bunch of internal dependencies spread across teams and it’s a cluster to unravel. My team is ahead of the curve but now we have this parallel branch that has been hanging around for 2 months and probably still will be for another 2-3 months waiting for a few things from other teams to be worked out

5

u/dscarmo Aug 21 '20

Some of the breaking changes in behaviour of built in functions is hard to debug and code will work but not producing what was intended originally

3

u/Kinglink Aug 21 '20

If I wasn't clear, I'm sure there's hard changes, but I think due to the number of python2 code out there, and the fact that short simple scripts are probably more common than deep functional code, a lot of it might just need a little developer time.

4

u/north_breeze Aug 20 '20

I wonder what percentage of legacy Python 2 is a 30 minute code review away from python 3 compliance

I think most python 2 code is not far from being python 3 compliant. The only problem is the amount of python 2 code out there.

3

u/[deleted] Aug 21 '20

Unicode stuff can be a hassle

1

u/Millerboycls09 Aug 21 '20

I'm new so take this question with a pound of salt.

Is the transition from python 2 to 3 easy in your case because it's all self-contained? Like... If your python 2 code utilized a bunch of libraries or stuff that maybe your team didn't even design (or fully understand), then that conversion might be impossible regardless of whether 3 new lines of code would fix it.

2

u/Kinglink Aug 21 '20

There was only three lines that looked like this.

print "hello"

They had to look like

print("hello") 

It really depends what you're scripts are doing, but for the most part I would imagine many scripts aren't doing anything at a deep level, but rather just some level of automation (note the script actually did a LOT, but much of the code was requests/curl commands that was portable)

Also a major thing at my studio is unit tests. We test the output of our functionality. So assuming you already had pytests for Python2, you bring those up to Python3, and they should still work, if they don't... well then you solve them.

I've found spending an extra day or two on unit tests will save you weeks or months later on. I'm lucky because our project managers trust and agree with us on that.