On 2 March 2017 at 13:11, Serhiy Storchaka <storch...@gmail.com> wrote: > On 02.03.17 14:20, Paul Moore wrote: >> >> So I guess I'm +0.5 on the proposed "positional only parameters" >> syntax, and -1 on any form of new language-defined sentinel value. > > > My proposition is not about "positional-only parameters".
Bah, sorry. I'm getting muddled between two different threads. I'm not having a good day, it seems :-( On the proposed feature, I don't like any of the proposed syntaxes (I'd rate "default=" with no value as the least bad, but I don't like it much; "default?" as opposed to "?default" is a possible option). I'm not convinced that the version using the new syntax is any easier to read or understand - the sentinel pattern is pretty well-understood by now, and a built-in replacement would need to result in noticeably simpler code (which this proposal doesn't seem to). Agreed that the help() output is ugly. It would of course be possible to give the sentinel a nicer repr, if you wanted: >>> class Sentinel(object): ... def __repr__(self): return "<Raise an exception>" ... >>> _sentinel = Sentinel() >>> def get(store, key, default=_sentinel): ... pass ... >>> help(get) Help on function get in module __main__: get(store, key, default=<Raise an exception>) Whether it's worth doing this depends on the application, of course (just like it's possible to hide the name of the sentinel if it matters sufficiently). Paul _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/