[Cython] Cython 3.0 and "unicode_literals"

Stefan Behnel stefan_ml at behnel.de
Sun Sep 16 11:21:08 EDT 2018


Jeroen Demeyer schrieb am 22.08.2018 um 13:10:
> On 2018-08-19 08:26, Stefan Behnel wrote:
>> Should we make that a new directive rather than a language level? Like
>> "py2_str=str"? That would allow its use together with language_level=3
>> already in the next release.
> 
> With a new new directive, you also run into compatibility problems. What
> should the default be? py2_str=str or py2_str=unicode? The former breaks
> code assuming that it's unicode and the latter doesn't really solve
> anything: stuff will still break when language_level=3 becomes the default.
> 
> My proposal is a new setting language_level=3str (meaning: everything that
> language_level=3 does, except unicode_literals) and make that the default.
> That way, you keep full compatibility with code already setting the
> language_level. You also have reasonably good chances that code that
> currently uses the implicit language_level=2 will continue to work with
> language_level=3str.

I thought about this some more and I like the idea. There's still the
true-division issue, but strings are certainly the biggest blocker in
migrations. As long as people want to support Python 2.x, "3str" is a way
to help them with it, and for Py3-only users, it won't make a difference.

Stefan


More information about the cython-devel mailing list