[Python-ideas] Verbatim names (allowing keywords as names)
MRAB
python at mrabarnett.plus.com
Thu May 17 19:18:26 EDT 2018
On 2018-05-17 22:38, Rob Cliffe via Python-ideas wrote:
>
>
> On 16/05/2018 10:12, Stephan Houben wrote:
>> Hi all,
>>
>> One problem already alluded to with the \identifier syntax is that it
>> only works
>> if the old Python version is sufficiently recent to understand \.
>>
>> What about using parentheses to allow a keyword to be used as an
>> identifier:
>> (where)(x, y)
>>
>>
> I believe this is the first proposal that allows future-proofing of new
> code while preserving complete backward compatibility. As far as I
> know, ( keyword ) is never legal syntax.
Apart from (False), (True) and (None), there's also (yield).
> Of course, putting brackets round every occurrence of every identifier
> that you think might become an identifier in the next century is a bit
> of a chore. There is no perfect solution.
>
More information about the Python-ideas
mailing list