Historically this has always been achieved by using: _default = object()
def fun(arg=_default): if arg is not _default: .... ...which does its job just fine. If you need something like this you're typically a medium/advanced Python user so you either already know about it or you'll find the solution on Google pretty quickly. A dedicated sentinel()/Sentinel/... thingy would just be more "official", but at the end of the day it would achieve exactly the same thing by adding more complexity to the language for no practical benefit (and I seriously think Python is getting too big). -1 On Thu, Jul 5, 2018 at 9:39 PM Flavio Curella <flavio.cure...@gmail.com> wrote: > More than once I've found myself wanting to create a 'sentinel' value. The > most common use case is to differentiate between an argument that has not > been provided, and an argument provided with the value `None`. > > This would be solvable by implementing something similar to what > JavaScript calls [`Symbol`]( > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol > ). > > This could be implemented as a 3rd-party library, but there won't be a way > to have ['Global' Symbols]( > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/for > ) > > Furthermore, without a common implementation in the std library, various > Python libraries had to write their own implementations, which all differs > in functionality and behavior. > > Is this something that the Python community is interested in? I'm willing > to write the PEP > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Giampaolo - http://grodola.blogspot.com
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/