Re: [Python-Dev] Status of the Argument Clinic DSL

2016年8月05日 05:39:13 -0700

On 08/04/2016 11:58 PM, Nick Coghlan wrote:
I occasionally wonder if we should document the "/" notation in
https://docs.python.org/3/library/inspect.html#introspecting-callables-with-the-signature-object
as it can sometimes show up in the text representation of signature
objects:
 >>> print(inspect.signature(format))
 (value, format_spec='', /)
I think we probably should. After all, this same string is used for pydoc:
 >>> import os
 >>> help(os.execv)
 Help on built-in function execv in module posix:
 execv(path, argv, /)
 Execute an executable path with arguments, replacing current
 process.
 path
 Path of executable file.
 argv
 Tuple or list of strings.
so it's easily user-visible.
I've always found it a little strange that the signatures for functions using Py_ArgParseTuple() had this / in them that wasn't Python syntax. On the other hand, it accurately reflects the fact that these functions have signatures that you can't write in Python. (And, FWIW, I wasn't the person who added the code that made "/" start showing up in the text representations of signatures. I was waffling on it, then someone else JFDI, to quote Barry.)
//arry/
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to