(original) (raw)



Sorry I missed answering these on my first pass.

On 06/06/2012 08:38 AM, Steven D'Aprano wrote:
What to do about parameters which are partly implemented? E.g. mode='spam' is implemented but mode='ham' is not.

Parameter objects aren't sophisticated enough to represent such a situation.  If you have a use case for a more sophisticated approach, and can propose a change to the Parameter object to handle it, I'd be interested to see it.

In truth, the way I currently support those "unimplemented" parameters is, passing in the default parameter is still permitted.  So in a way I suppose I already have this situation, kinda?  But is\_implemented as it stands works fine for my use case.

inspect.getfullargspec is currently unable to introspect builtin functions and methods. Should builtins gain a \_\_signature\_\_ so they can be introspected?

If function signatures are useful, then they're useful, and the implementation language for the function is irrelevant.  I already sent Yuri a patch adding \_\_signature\_\_ to PyCFunctionObject, which I thought he merged but I don't see in his repo.

The problem (obviously) is generating the signature.  Brett has an idea about parsing the docstring; it strikes me as hackish.  I think solving the problem definitively will require a new argument parsing API and that's simply not happening for 3.3.

If my patch for issue 14626 and PEP 362 both land in 3.3, my plan is to hard-code the signatures for just those functions.


/arry