On Thu, Nov 6, 2008 at 3:47 PM, Greg Falcon <veloso@verylowsodium.com> wrote:
On Thu, Nov 6, 2008 at 3:31 PM, George Sakkis <george.sakkis@gmail.com> wrote:
> Several times I find myself using the following idiom:
>
> _Missing = object() # sentinel
>
> def foo(x, y=_Missing):
> if y is _Missing:
> do_this
> else:
> do_that
> It would be nice if a new object or keyword, say __missing__, was> Thoughts ?
> introduced as a canonical way to address this common scenario.
This has been proposed and shot down before:
http://mail.python.org/pipermail/python-dev/2007-May/073439.html
The older proposal didn't give __missing__ the special run-time and
compile-time error behaviors,
but this actually just makes things
worse. Why complicate the language merely to save a single idiomatic
line of code dealing with a relatively infrequent use-case?