[Cython] Preparing the language level change

Stefan Behnel stefan_ml at behnel.de
Tue Sep 25 01:24:48 EDT 2018


Daniele Nicolodi schrieb am 25.09.2018 um 00:28:
> On 24-09-2018 14:05, Stefan Behnel wrote:
>> I added a new directive "str_is_str=True" which can be combined with
>> "language_level=3" to get the desired behaviour. It keeps the 'str' builtin
>> type as it is (it would otherwise become 'unicode' with level 3) and keeps
>> unprefixed string literals as type 'str' in Py2 and Py3. Everything else
>> should depend solely on the language_level switch.
> 
> For consistency with the CPython
> 
>   from __future__ import unicode_literals
> 
> wouldn't it be better to call this directive "str_literals"?
> 
> I realize there isn't 100% overlap in the functionality of the two, but
> I find the "str_is_str" name not very descriptive.

I started off with "unicode_literals=False", and then renamed it because
this name didn't cover the change of "str" to "unicode" (i.e. renaming the
usages of the builtin type internally, so that "str(x)" actually calls
"unicode(x)").

Looks like this bikeshed needs painting, so let's have a quick(!)
discussion or vote.

- should this feature touch the builtin type at all?

- more opinions on the name?

Stefan


More information about the cython-devel mailing list