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

Brett Cannon brett at python.org
Thu Jul 1 20:50:27 CEST 2010


On Wed, Jun 30, 2010 at 13:24, Benjamin Peterson <benjamin at python.org> wrote:
> 2010/6/30 Brett Cannon <brett at python.org>:
>> 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.
>
> Moved, thank you.
>
>>
>> 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.
>
> I believe sys.exc_info()[:2] is still the correct way in both Python versions.

It is, I just don't know how widely known the idiom is. Maybe just a
mention in the documentation? Or better yet, hope the PSF gets me that
grant money so I can write a HOWTO on all of this and just mention it
myself (along with 'six' of course).

>
>>
>> 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.
>
> Done.
>
>
>
> --
> Regards,
> Benjamin
>


More information about the Python-porting mailing list