[Numpy-discussion] Bytes vs. Unicode in Python3

René Dudfield renesd at gmail.com
Fri Nov 27 09:07:00 EST 2009

On Fri, Nov 27, 2009 at 1:41 PM, Pauli Virtanen <pav at iki.fi> wrote:
>> 2to3/3to2 fixers will probably have to be written for users code
>> here... whatever is decided.  At least warnings should be generated
>> I'm guessing.
> Possibly. Does 2to3 support plugins? If yes, it could be possible to
> write one.

You can put them in here:

I'm not sure about how to use custom ones without just copying them
in... need to research that.

There's no documentation about how to write custom ones here:

You can pass lib2to3 a package to try import fixers from.  However I'm
not sure how to make that appear from the command line, other than
copying the fixer into place.  I guess the numpy setup script could
copy the fixer into place.

>> btw, in my numpy tree there is a unicode_() alias to str in py3, and
>> to unicode in py2 (inside the compat.py file).  This helped us in many
>> cases with compatible string code in the pygame port.  This allows you
>> to create unicode strings on both platforms with the same code.
> Yes, I saw that. The name unicode_ is however already taken by the Numpy
> scalar type, so we need to think of a different name for it. asstring,
> maybe.

something like numpy.compat.unicode_ ?

> Btw, do you want to rebase your distutils changes on top of my tree? I
> tried yours out quickly, but there were some issues there that prevented
> distutils from working. (Also, you can use absolute imports both for
> Python 2 and 3 -- there's probably no need to use relative imports.)
>        Pauli


yeah I definitely would :)   I don't have much time for the next week
or so though.


More information about the NumPy-Discussion mailing list