Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use from six.moves import ... #141

Open
pavlix opened this issue Oct 3, 2016 · 1 comment
Open

use from six.moves import ... #141

pavlix opened this issue Oct 3, 2016 · 1 comment

Comments

@pavlix
Copy link

pavlix commented Oct 3, 2016

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()
pavlix added a commit to pavlix/centpkg that referenced this issue Oct 28, 2016
The output of modernize tool is not always optimal. This patch makes
usage of `six.moves` less awkward.

Related: PyCQA/modernize#141

Signed-off-by: Pavel Šimerda <[email protected]>
@ngie-eign
Copy link

+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" 😄 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants