Python 3

Robert Collins robertc at robertcollins.net
Wed Jun 23 08:48:54 BST 2010


On Wed, Jun 23, 2010 at 7:47 PM, Vincent Ladeuil <v.ladeuil+lp at free.fr> wrote:
>>>>>> Robert Collins <robertc at robertcollins.net> writes:
>
> <snip/>
>
>    > This is the docstring from testtools.compat for its _u function (just
>    > tidied up a few minutes ago):
>    > +"""A function version of the 'u' prefix.
>    > +
>    > +This is needed becayse the u prefix is not usable in Python 3 but is required
>    > +in Python 2 to get a unicode object.
>    > +
>    > +To migrate code that was written as u'\u1234' in Python 2 to 2+3 change
>    > +it to be _u('\u1234'). The Python 3 interpreter will decode it
>
> s/decode it/decode '\u1234'/ ?
>
> I had to re-read to come to this conclusion ("Python3 will decode" and
> "Python 3 lets it through" are contradictory otherwise).

Please put a patch forward to testtools - it can probably be improved better.

There are two function definitions, one for 2.x and one for 3, and the
explanation needs to explain how you end up with the right stuff on
both versions, and why its needed.

-Rob



More information about the bazaar mailing list