[Python-ideas] __missing__ object/keyword
python at rcn.com
Thu Nov 6 22:18:58 CET 2008
From: "George Sakkis" <george.sakkis at gmail.com>
> It would be nice if a new object or keyword, say __missing__, was
> introduced as a canonical way to address this common scenario.
> Specifically, the only valid usages of __missing__ would be:
> 1. As a default argument in a callable.
> 2. In identity tests: <var> is __missing__
> Anything else would raise either a SyntaxError (e.g. `x =
> __missing__`) or a RuntimeError/TypeError (e.g. `x = y` if y is
> __missing__). Only the interpreter could assign __missing__ to a name
> when binding objects to formal parameters.
It would be nice to not introduce a new language feature for every
minor programming idiom. IMO, growing the language with more
special cases does not make it easier to learn and use.
More information about the Python-ideas