On 02.03.2017 10:06, Serhiy Storchaka wrote: > On 02.03.17 10:36, M.-A. Lemburg wrote: >> Why a new syntax ? Can't we just have a pre-defined sentinel >> singleton NoDefault and use that throughout the code (and also >> special case it in argument parsing/handling)? >> >> def get(store, key, default=NoDefault): >> if store.exists(key): >> return store.retrieve(key) >> ... > > This means adding a new syntax. NoDefault should be a keyword (we can > reuse existing keyword couldn't be used in expression), and it should be > accepted only in the specific context of declaring function parameter.
This is not new syntax, nor is it a keyword. It's only a new singleton and it is well usable outside of function declarations as well, e.g. for class attributes which are not yet initialized (and which can accept None as value). The only special casing would be in function call parameter parsing to signal errors when the parameter is used as keyword parameter. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Mar 02 2017) >>> Python Projects, Coaching and Consulting ... http://www.egenix.com/ >>> Python Database Interfaces ... http://products.egenix.com/ >>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ ________________________________________________________________________ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ http://www.malemburg.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/