3 ms·
I'm fairly sure I'm handling strings correctly under Python 2. What I'm not sure of is the risk of something breaking if I upgrade to Python 3, especially when
by nodamage 10y ago
I'm fairly sure I'm handling strings correctly under Python 2. What I'm not sure of is the risk of something breaking if I upgrade to Python 3, especially when it comes to upgrading external dependencies. Even if it's just non-backwards compatible API changes, it's more risk to deal with.
- mkesper 10y agoIsn't that what test bases are for?
- nodamage 10y agoTests will tell you something broke, you still have to go through the work of figuring out why and how to fix it.
- rtpg 10y agoYou're fairly certain, but with Python 3 you can be completely certain. That's the magic of it. Python 2 will allow this to sometimes work, Python 3 will make sure this never works, because there's a bytes/text mismatch. It's nice to rule out entire classes of bugs like this from sys import argv import json with open(argv[1], 'rb') as f: json.loads(f.read()) Porting is still difficult. But when we ported from Py2 to Py3, we found a couple issues like this (despite dealing with weird encodings all the time).
- lima 10y agoExactly this. When I ported my stuff to Python 3, I fixed many encoding bugs in the process. You can do this correctly in Python 2, it's just much harder.
- criddell 10y agoDo you think you will ever have to move to Python 3?
- nodamage 10y agoI don't know. I will probably try to by 2020 once it gets officially EOLed. Until then I have plenty of other work to do.