Python 3
Vincent Ladeuil
v.ladeuil+lp at free.fr
Wed Jun 23 08:47:20 BST 2010
>>>>> 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).
> +appropriately and the no-op _u for Python 3 lets it through, in Python
> +2 we then call unicode-escape in the _u function.
> +"""
More information about the bazaar
mailing list