modernize
modernize copied to clipboard
use `from six.moves import ...`
The resulting code for simple library imports makes code unnecessarily verbose. For example when you import ConfigParser in legacy code or configparser in Python 3.x code, you generally don't want to access the class via six.moves.configparser.ConfigParser. See example below.
Legacy code:
import ConfigParser
parser = ConfigParser.ConfigParser()
Python 3.x code:
import configparser
parser = configparser.ConfigParser()
Modernized code:
import six.moves.configparser
parser = six.moves.configparser.ConfigParser()
+1. I find this to be an annoying "feature".
At the end of the day, what I'd really like is for a minimal amount of changed lines in the code, compared to a maximal amount of changed lines. Especially because (someday), the six support will need to be ripped out/augmented for new compatibility -- maybe in the next project major version jump from 3 to 4, aka "twelve" 😄 ?