[Python-ideas] Optional parameters without default value

Sven R. Kunze srkunze at mail.de
Fri Mar 3 08:19:24 EST 2017


On 03.03.2017 14:06, Victor Stinner wrote:
> 2017-03-03 6:13 GMT+01:00 Mike Miller <python-ideas at mgmiller.net>:
>> Agreed, I've rarely found a need for a "second None" or sentinel either, but
>> once every few years I do.  So, this use case doesn't seem to be common
>> enough to devote special syntax or a keyword to from my perspective.
> The question here is how to have an official support of this feature
> in inspect.signature().
>
> If we go to the special value (singleton) way, Ellispis doesn't work
> neither since a few modules use Ellipsis for legit use case. Recent
> user: the typing module for "Callable[[arg, ...], result]".

Exactly.

So, it should be obvious to you, that introducing "official" support 
leads yet to an endless chain of "but I would need yet another None" 
because we already use [None, Undefined, NotUsed, Ellipsis, <syntax>, 
pypi project] in our projects.

Having every project rolling their own "NotDefined" makes it completely 
incompatible to each other. So, it's not possible to plug in return 
values to other functions and gets bitten.


Not providing an "official" solution, solves the matter.


Best,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170303/b6553ed9/attachment.html>


More information about the Python-ideas mailing list