Using PyArg_ParseTuple to with optional fields.
stefan_ml at behnel.de
Thu Feb 28 04:47:54 EST 2019
Anthony Flury via Python-list schrieb am 28.02.19 um 10:18:
> I am trying to write an extension module with a function (actually an
> __init__ method, but I am not sure that matters) where the function can be
> called as either :
> my_func( a, b, c, d) - where a,b,c,d are all doubles.
> I would prefer not to allow the function to be called with some arguments
> specified - it is either all four - or none.
You could do the argument checking yourself, after extracting them.
But (without knowing what you're actually up to here) – are you sure the
above is a good user interface? Did you consider splitting the function
into two, one that takes arguments and one that takes none?
More information about the Python-list