spitfire icon indicating copy to clipboard operation
spitfire copied to clipboard

Add Six library to third_party

Open trimbo opened this issue 5 years ago • 4 comments

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".

trimbo avatar Aug 26 '19 21:08 trimbo

Do we need six?

nicksay avatar Aug 28 '19 20:08 nicksay

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

trimbo avatar Aug 28 '19 22:08 trimbo

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

nicksay avatar Aug 29 '19 02:08 nicksay

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.

Pehat avatar Aug 29 '19 09:08 Pehat