[Python-Dev] Re: The repr of a sentinel

2021年5月24日 07:39:11 -0700

On Mon, May 24, 2021 at 4:10 AM MRAB <[email protected]> wrote:
>
> On 2021年05月24日 01:37, Luciano Ramalho wrote:
> > Now I can use NotGiven as the sentinel, and its default repr is <NotGiven>.
> >
> The repr of other singletons are the names of those singletons, eg.
> "None", so why "<NotGiven>" instead of "NotGiven"?
Yea, that's up in the air. The common suggestions are either
"NotGiven", "<NotGiven>" or "mymodule.NotGiven".
The first makes sense for builtins like None and Ellipses, but I'm not
sure a function signature like foo(bar=NotGiven) is very clear.
With the factory function pattern there's no need for a default, so
this may become a non-issue, and I may remove the recommendation for
which form to use.
- Tal
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/WMS3CLQ765HAN3WCQKCL2XSSJUNP45LY/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to