On Sun, Sep 27, 2020 at 2:18 PM MRAB <pyt...@mrabarnett.plus.com> wrote:

> Consider, for example, the use-case of a function that has an optional
> parameter and you want a way to know whether an argument has been
> provided but None is a valid value that could be passed in.
>
> Having a singleton such as Missing would be helpful there.
>

The trouble is that's what None was supposed to be for. Over time, Missing
would presumably fall victim to the same fate that befell None. You'd also
probably have to extend PEP 505 to support Missing-aware operators.

Maybe a singleton that supported no useful operations, not even __eq__ or
__bool__, would be sufficiently inconvenient that it would only be used for
defaults and "is" tests for said defaults.



On Sun, Sep 27, 2020 at 10:52 PM Chris Angelico <ros...@gmail.com> wrote:

> English treats 1 as special and 0 as the same as other numbers when it
> comes to singulars and plurals. [...] What do
> other languages do in this way?
>

You were asking about natural languages but perhaps it's worth mentioning
that Haskell has tuples of length 0, 2, 3, ..., but no tuples of length 1.
Tuples are meant for putting n values where 1 value is expected, and when
n=1 you just put the value there.



On Mon, Sep 28, 2020 at 11:47 AM Stefano Borini <stefano.bor...@gmail.com>
wrote:

> Also, it would give different behavior between d[x] and d[x, **kw],
> which in my opinion should be a fully degenerate case.
>

On the other hand, it would make d[x,] and d[x, **kw] consistent, which
they also ought to be.

What a mess.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/XQ47DN75KKH5LECSBCGSCH5WVLKMYDIS/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to