[Python-Dev] Status of the Argument Clinic DSL
Larry Hastings
larry at hastings.org
Fri Aug 5 08:36:19 EDT 2016
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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160805/98a17587/attachment.html>
More information about the Python-Dev
mailing list