[Python-Dev] PEP 457: Syntax For Positional-Only Parameters

Ethan Furman ethan at stoneleaf.us
Wed Oct 9 02:38:05 CEST 2013


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~


More information about the Python-Dev mailing list