[Python-Dev] Normalisation of unicode and keywords (original) (raw)
Steven D'Aprano steve at pearwood.info
Fri May 18 07:46:11 EDT 2018
- Previous message (by thread): [Python-Dev] [Python-checkins] bpo-33522: Enable CI builds on Visual Studio Team Services (GH-6865) (GH-6925)
- Next message (by thread): [Python-Dev] Normalisation of unicode and keywords
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Stephan Houben noticed that Python apparently allows identifiers to be keywords, if you use Unicode "mathematical bold" letters. His explanation is that the identifier is normalised, but not until after keywords are checked for. So this works:
class Spam: locals()['if'] = 1
Spam.𝐢𝐟 # U+1D422 U+1D41F
returns 1
Of course Spam.if fails with SyntaxError.
Should this work? Is this a bug, a feature, or an accident of implementation we can ignore?
-- Steve
- Previous message (by thread): [Python-Dev] [Python-checkins] bpo-33522: Enable CI builds on Visual Studio Team Services (GH-6865) (GH-6925)
- Next message (by thread): [Python-Dev] Normalisation of unicode and keywords
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]