What are “soft keywords”?

Short: Soft keywords can still be used as variable or argument names.

PEP 622 sheds some light (Emphasis mine):

The difference between hard and soft keywords is that hard keywords are always reserved words, even in positions where they make no sense (e.g. x = class + 1), while soft keywords only get a special meaning in context.

[…] The match and case keywords are proposed to be soft keywords, so that they are recognized as keywords at the beginning of a match statement or case block respectively, but are allowed to be used in other places as variable or argument names.

Leave a Comment