On Nov 6, 2012 2:12 AM, "Barry Warsaw" email@example.com wrote:
On Nov 05, 2012, at 06:04 PM, Nick Coghlan wrote:
Even better (http://packages.python.org/six/#package-contents):
if six.PY3: # Ooh, Python 3 else: # Not Python 3
If anyone is trying to do single code base Python 2/3 support without relying on six, they're doing it wrong. Even bundling a copy (if you don't want to deal with dependency management issues) is a better idea than reinventing that wheel.
If you *are* rolling your own (or need additional compatibility fixes that six doesn't provide), then all Python 2/3 compatibility hacks should be located in a small number of compatibility modules. They *shouldn't* be distributed widely throughout your codebase.
While I agree with the sentiment, and also agree that six is an excellent package that can be very useful, I'll just point out that it's often very possible and not at all painful to write to a single code base without
it. It all depends on what your code does/needs.
True, my own 2/3 compatible projects don't use it, but they also don't have any significant special cases for either version. I guess stick a "for non-trivial cases" qualifier in there somewhere :)
-- Sent from my phone, thus the relative brevity :)
Python-ideas mailing list Pythonfirstname.lastname@example.org http://mail.python.org/mailman/listinfo/python-ideas