On 10/08/2013 05:15 PM, Steven D'Aprano wrote:
On Wed, Oct 09, 2013 at 01:33:26AM +0200, Larry Hastings wrote:

The obvious solution: add a new singleton constant to Python
that is passed in when a parameter is not mapped to an argument.
I propose that the value be called called ``undefined``,
and be a singleton of a special class called ``Undefined``.
If a positional-only parameter did not receive an argument
when called, its value would be set to ``undefined``.

I would much prefer Undefined and UndefinedType. That matches other
singletons like None, NotImplemented, Ellipsis, even True and False.

The type of Ellipsis is ellipsis, and the type of True and False is bool. ;) That aside, I agree that Undefined and UndefinedType would be better.


What (if any) methods and attributes would Undefined have? If it doesn't
have any, doesn't that make it functionally equivalent to None? Why not
just use None? The PEP needs to explain why it needs to invent yet
another singleton that quacks like None.

I think the key question here is are there places where None is the passed in value, and its meaning is something besides "no value passed in". I don't know the answer.


[Bikeshed: perhaps Missing is more appropriate than Undefined? After
all, the parameter is defined, only the value is missing.]

Or the value is undefined. ;)

--
~Ethan~
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to