On Tue, Oct 26, 2021 at 1:35 PM Ethan Furman <et...@stoneleaf.us> wrote:
> > to PASS SOMETHING that says "give me the default". With this proposed > API, we don't > > have that; the only want to say "give me the default" is to NOT pass > something. > but that, in fact, is all that Python provides. yes, None indicating "use the default" is a very common idiom, but it is only an convention, and you can't be sure it will work with every API. Not passing a value is the only way to indicate that, well, you have not passed a value ;-) I think this ideas is addressing two related issues: 1) we have to write extra boilerplate code to process mutable (or calculated) default arguments. 2) There is no well defined way to specify "not specified" -- None is a convention, but it isnot used everywhere, and there are some places it can't be used, as None is heavily overloaded and is a valid value in some cases. When this PEP originally came out I thought that passing None was the way > to trigger it -- if that's not the case, and there is nothing we can pass > to trigger it, I am much less interested. > See (2) above -- we really should not make None an "official" way to specify not-set, or use-default. If we wanted to, we could create a new standard sentinel for that, say "MISSING", and then allow folks to use that, or omit the argument. But frankly, I don't see the point. we already have the args tuple and kwargs dict -- it is not hard to omit items from those. But in a previous thread, I argued for a handful of standard sentinels so that we wouldn't have to overload None so much -- so MISSINGdoes have it's appeal. -CHB -- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
_______________________________________________ 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/MSU2PLOCJKFORHZWYECJEKH3CWXCBUEV/ Code of Conduct: http://python.org/psf/codeofconduct/