[Python-Dev] Status of the Argument Clinic DSL

Nick Coghlan ncoghlan at gmail.com
Fri Aug 5 02:58:14 EDT 2016


On 5 August 2016 at 09:12, Larry Hastings <larry at hastings.org> wrote:
> / is the delimiter between positional-only parameters and
> positional-or-keyword arguments.  It's not actual Python syntax, but Guido
> said (somewhere) that *if* Python ever sprouted a syntax for positional-only
> parameters, that was as good a delimiter as any.  I think he picked it
> because / is the inverse of *.

I was thinking Guido picked the "/" symbol when we were discussing the
Argument Clinic DSL at PyCon 2014 and you had also been working on
https://www.python.org/dev/peps/pep-0457/

However, re-reading the latter shows it dates back earlier than that:
https://www.python.org/dev/peps/pep-0457/#guido

> If you have more questions about __text_signature__, I recommend reading the
> implementation of inspect.signature, since that's the one and only consumer
> of it.

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='', /)

Likewise for describing the option of using __text_signature__ to
override the default inspect.signature() output (and perhaps adding a
public "inspect.Signature.from_text" alternate constructor at the same
time).

However, either notion is a bit tricky while PEP 457 is still in draft
rather than accepted - even if it's "just" a syntax for overriding
inspect.signature, we'd still be effectively locking this in as *the*
syntax for positional-only arguments (if they're ever added)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list