Re:Python 2.7.18, the last release of Python 2
by JimDabell on Tuesday April 21, 2020 @04:39AM
(#22933139)
> something changed with dict enumeration order between python 2 and 3
Dicts were by definition unordered until Python 3.7 [0], so you were relying on undefined behaviour. If you need an ordered dictionary and support Python 3.6 or below, you should use OrderedDict [1].
[0] https://mail.python.org/pipermail/python-dev/2017-December/1...
[1] https://docs.python.org/3/library/collections.html#collectio...
Re:Python 2.7.18, the last release of Python 2
by toyg on Tuesday April 21, 2020 @04:35AM
(#22933120)
> something changed with dict enumeration order between python 2 and 3
Enumeration order in dict keys was never guaranteed (until 2019), even on 2. So basically that code relied on undocumented cpython behaviour that was strongly advised against, i.e. it was broken already. 3 simply made the brokenness more visible.
The string-handling changes, while necessary, are also a bear to deal with. Since python is dynamically typed, you need to work to find all the places where you need to add a ".decode()" or ".encode()". If you don't have excellent test coverage already, you're going to miss some, and it'll be a game of whack-a-mole until you get them all... assuming you have actually gotten them all.