[Python-porting] [ANN] Six, utilities for supporting Python 2 and 3 with the same code base

Brett Cannon brett at python.org
Wed Jun 30 21:18:38 CEST 2010


On Tue, Jun 29, 2010 at 13:57, Benjamin Peterson <benjamin at python.org> wrote:
> I've just released for the first time six, a set of helpers for
> maintaining a code base on Python 2 and 3 simultaneously. It includes
> fake byte and unicode literals and wrappers for syntax changes between
> the languages. The license is MIT.
>
> You can download it on PyPi: http://pypi.python.org/pypi/six
> or read the documentation: http://packages.python.org/six/
>
> Bugs can be reported to the Launchpad page: http://bugs.launchpad.net/python-six

I was actually thinking about doing this; you beat me to it! =)

Looks good overall. Only three suggestions. One is that the
documentation for const is a little confusing; I would move the
example to the end as I thought that dispatch_types was an actual
function in the module instead of just example usage.

Two, is there a need for a function to get the currently raised
exception (especially without the traceback to prevent accidental
circular loops)? Since that part of the syntax changed it would
probably be good to have a function to call which returns the raised
exception. Don't remember if the 'with' statement cleans up its
variables, but if it does then the traceback object could be exposed
on a context manager w/o leaking.

And lastly, a link back to the PyPI page from the packages.python.org
pages would be good in case the docs end up ranking higher in searches
than the PyPI page.


More information about the Python-porting mailing list