[Python-ideas] sys.py3k

Barry Warsaw barry at python.org
Mon Nov 5 17:11:06 CET 2012

On Nov 05, 2012, at 06:04 PM, Nick Coghlan wrote:

>Even better (http://packages.python.org/six/#package-contents):
>    import six
>    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 using
it.  It all depends on what your code does/needs.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121105/081a5ad9/attachment.pgp>

More information about the Python-ideas mailing list