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

Georg Brandl g.brandl at gmx.net
Wed Oct 9 16:26:21 CEST 2013


Am 09.10.2013 15:56, schrieb Larry Hastings:
> On 10/09/2013 07:15 AM, Georg Brandl wrote:
>> We have quite a large
>> amount of C functions with positional-only parameters.  Adding a "/"
>> to each of those is a) a tedious task and b) probably not helpful for
>> a lot of people:
> 
> I volunteer to ensure that the "/"s are added if this PEP is accepted.  (I
> expect I'd do it myself, but who knows, maybe a volunteer would appear out of
> the woodwork.)

Yes, the much bigger concern is the second one.

>> ...  and the "undefined" singleton just smells wrong.  Another way
>> to spell "None" is just asking for trouble.
> 
> It has to be a different value from "None", for the same reasons that all those
> other different-spellings-for-None (e.g. inspect.Parameter.empty) exist.

I know.  Still, as a new builtin it will get used for all kinds of other
purposes, especially when it has the name that other languages use for
our None.

Maybe you could get away with NotGiven or NotPassed (in parallel to
NotImplemented).

> I realize you are -1 on the proposal in general, but I'd be very interested if
> you could propose an alternate approach where I didn't need "a new spelling for
> None" as you put it.

I think I would make Steven's proposed syntax mandatory: let the implementor
of the function decide which value stands for "not given" -- just like we do
in the C version, BTW.

cheers,
Georg



More information about the Python-Dev mailing list