spitfire
spitfire copied to clipboard
Add Six library to third_party
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".
Do we need six
?
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
I'm not strictly against it, but looking at #80 I don't see a ton of benefit of adding the new dependency (yet)
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.