On Wed, Oct 27, 2021 at 10:14 AM Christopher Barker <python...@gmail.com> wrote:
>
> Hmm, it seems our notes crossed paths, sorry.
>
> On Tue, Oct 26, 2021 at 2:12 PM Chris Angelico <ros...@gmail.com> wrote:
>>
>> The trouble with sentinel values is that you always need another one.
>> Sooner or later, you're going to need to talk about the _missing
>> object, and you'll need to distinguish it from the absence of an
>> object.
>>
>> If there is a way to say "don't pass this argument", it would have to
>> be some kind of syntactic token.
>
>
> I don't think that's true. even now, folks can misuse None, and True and 
> False in all sorts of ways, but if a singleton is well documented to mean 
> "missing argument" then anyone who uses it some other way gets what they 
> deserve.
>
> The reason None can't be counted on to mean MISSING is that is, in fact, used 
> in other ways already.
>

None is a great sentinel for a lot of cases, but it can't do
everything. If your API documents that None means absent, then sure,
that works fine! But sometimes you can't, because None has other
meaning. If you create a single global sentinel for _missing, sooner
or later, it will become necessary to distinguish it from actual
absence - for instance, when iterating over the builtins and doing
something with each object.

The truth is that there is no value that can be a truly universal
representation of absence, so it *always* has to be specific to each
API.

Using *a, **kw does allow us to truly omit an argument.

ChrisA
_______________________________________________
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/ECOQ26OY3LPILMHSVSYU6ZVVKI5SKYJ2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to