4 ms·
This isn't ideal as a version upgrade may also change the parameter type from a third party library, and these tools cannot detect it: old.py: bs = raw_inpu
by htfy96 6y ago
This isn't ideal as a version upgrade may also change the parameter type from a third party library, and these tools cannot detect it:
old.py:
bs = raw_input()
# Call a 3ps which originally accepts a bytestream, but now accepts a string
some_3rd_party_function(bs)
After python-modernize:
from six.moves import input
bs = input()
# Your code using bs as a bytestring still works
# Runtime Error:
# This now accepts a string, and you need to modify your code to deal with random TypeError popping from everywhere
some_3rd_party_function(bs)
- acdha 6y agoYour second case is why I had —no-six in my example to prevent what you showed. In both cases, as shown in the linked documentation, these tools are designed to support staged migrations for exactly this reason.