[Python-Dev] AC Derby and accepting None for optional positional arguments
python at mrabarnett.plus.com
Thu Jan 16 13:21:19 CET 2014
On 2014-01-16 05:32, Larry Hastings wrote:
> In the specific case of SHA1_new's "string" parameter, we could lie and
> claim that the default value is b''. Internally we could still use NULL
> as a default and get away with it. But this is only a happy
> coincidence. Many (most?) functions like this won't have a clever
> Python value we can trick you with.
> What else could we do? 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__"?
> The only other option I can see: don't convert SHA1_new() to use
> Argument Clinic, and don't provide introspection information for it either.
> Can you, gentle reader, suggest a better option?
> p.s. Ryan's function signatures above suggest that he's converting code
> from using PyArg_ParseTuple into using PyArg_ParseTupleAndKeywords. I
> don't think he's *actually* doing that, and if I saw that in patches
> submitted to me I would ask that it be fixed.
More information about the Python-Dev