News for hackers. Stuff that matters.
Re:Removing Python 2.x support from Django for version 2.0 by viraptor on Thursday January 19, 2017 @05:46AM (#13434728)
What py3 does is it enforces the things that py2 only suggests as far as unicode goes. That means on py2 you can go for the proper handling and if you did do everything right, then py3 migration should be almost boring.

The difference is when you didn't handle all the cases correctly. In that situation Py2 will silently do either the right, or the wrong thing and you'll never know. Py3 will likely throw an extension and tell you where the issue is.

So if you're handling lots of unicode text and think you've handled all the string correctly already - that's the reason to move. Now you'll be sure it's correct. The problem with py2 wasn't so much that it was handling anything badly - it was that the default, easy way was incorrect and just waiting to blow up in peoples' faces. (or maybe just silently corrupt something)

Re:Removing Python 2.x support from Django for version 2.0 by nodamage on Thursday January 19, 2017 @06:08AM (#13434828)
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.
Re:Removing Python 2.x support from Django for version 2.0 by rtpg on Thursday January 19, 2017 @07:55AM (#13435353)
You'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).
Re:Removing Python 2.x support from Django for version 2.0 by lima on Thursday January 19, 2017 @10:18AM (#13436398)
Exactly 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.

Re:Removing Python 2.x support from Django for version 2.0 by criddell on Thursday January 19, 2017 @08:50AM (#13435707)
Do you think you will ever have to move to Python 3?
Re:Removing Python 2.x support from Django for version 2.0 by nodamage on Thursday January 19, 2017 @04:16PM (#13439572)
I 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.
Re:Removing Python 2.x support from Django for version 2.0 by mkesper on Thursday January 19, 2017 @07:08AM (#13435117)
Isn't that what test bases are for?
Re:Removing Python 2.x support from Django for version 2.0 by nodamage on Thursday January 19, 2017 @04:15PM (#13439566)
Tests will tell you something broke, you still have to go through the work of figuring out why and how to fix it.