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

Add Six library to third_party #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

trimbo
Copy link
Contributor

@trimbo trimbo commented Aug 26, 2019

Let me know if you think we should do this or move to more traditional means with PIP

Only ugliness is we'll need to "from third_party import six" instead of just "import six".

@nicksay
Copy link
Contributor

nicksay commented Aug 28, 2019

Do we need six?

@trimbo
Copy link
Contributor Author

trimbo commented Aug 28, 2019

No, but we'd just be duplicating its functionality so the convenience factor is high. I tend to agree with what IIRC @Pehat suggested offline, which is we can move to leveraging pip for dependencies

@nicksay
Copy link
Contributor

nicksay commented Aug 29, 2019

I'm not strictly against it, but looking at #80 I don't see a ton of benefit of adding the new dependency (yet)

@Pehat
Copy link

Pehat commented Aug 29, 2019

I'm not strictly against it, but looking at #80 I don't see a ton of benefit of adding the new dependency (yet)

Well, it's quite simple to use iter in your example (and it's good solution because it's readable and needs no dependencies).

Writing try...except ImportError every time when you need to import a renamed module is verbose; you may use the same imports in different modules, so this solution can lead to unnecessary copypaste.

When you need to catch all the possible binary-unicode incompatibility problems, it may be too clumsy to make these conversions, checking every time if sys.PY2.

However, you can save all these compatibility utils in one module. But this is what six actually used for!

six can be used as a quick solution for migrating to Python 3, and when the Python 2 supported is dropped, six can be easily removed from your code - it's much simpler to convert from py2 & py3 compatible code to py3-only.

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

Successfully merging this pull request may close these issues.

4 participants