[Python-Dev] Updated PEP 362 (Function Signature Object) (original) (raw)

Larry Hastings larry at hastings.org
Wed Jun 6 19:48:28 CEST 2012


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/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20120606/d0cc42d0/attachment.html>



More information about the Python-Dev mailing list