[Python-Dev] AC Derby and accepting None for optional positional arguments

Mark Shannon mark at hotpy.org
Thu Jan 16 21:15:23 CET 2014


On 16/01/14 19:43, Larry Hastings wrote:
> On 01/16/2014 04:21 AM, MRAB wrote:
>> On 2014-01-16 05:32, Larry Hastings wrote:
>> [snip]
>>
>>> We could add a special value, let's call it
>>> sys.NULL, whose specific semantics are "turns into NULL when passed into
>>> builtins".  This would solve the problem but it's really, really awful.
>>>
>> Would it be better if it were called "__null__"?
>
> No.  The problem is not the name, the problem is in the semantics. This
> would mean a permanent special case in Python's argument parsing (and
> "special cases aren't special enough to break the rules"), and would
> inflict these same awful semantics on alternate implementations like
> PyPy, Jython, and IronPython.

Indeed.

Why not just change the clinic spec a bit, from
'The "default" is a Python literal value.' to
'The "default" is a Python literal value or NULL.'?

A NULL default would imply the parameter is optional
with no default.


Cheers,
Mark.


More information about the Python-Dev mailing list