[Numpy-discussion] numpydoc for python 3?
Pauli Virtanen
pav at iki.fi
Wed Jan 16 15:36:13 EST 2013
14.01.2013 14:44, Matthew Brett kirjoitti:
[clip]
> Pierre's suggestion is good; you can also do something like this:
>
> # -*- coding: utf8 -*-
> import sys
>
> if sys.version_info[0] >= 3:
> a = 'öäöäöäöäöåååå'
> else:
> a = unicode('öäöäöäöäöåååå', 'utf8')
>
> The 'coding' line has to be the first or second line in the file.
Another useful option would be
from __future__ import unicode_literals
This makes the literal
'spam'
be unicode also on Python 2, so that
b'spam'
is bytes. This might make unicode unification easier.
OTOH, it might open some cans of worms.
--
Pauli Virtanen
More information about the NumPy-Discussion
mailing list