[Python-3000] PEP3102 Keyword-Only Arguments; Signature

Jim Jewett jimjjewett at gmail.com
Mon Aug 14 22:24:15 CEST 2006

On 8/14/06, Steven Bethard <steven.bethard at gmail.com> wrote:
> On 8/14/06, Guido van Rossum <guido at python.org> wrote:
> > I believe the PEP doesn't address the opposite use case: positional
> > arguments that should *not* be specified as keyword arguments.

> It would be really nice in the example above to mark ``self`` in
> ``__call__`` as a positional only argument.

Would this have to be in the standard function prologue, or would it
be acceptable to modify a function's Signature object?

As I see it, each argument can be any combination of the following:


I can see some value in supporting all 32 possibilities, but doing it
directly as part of the def syntax might get awkward.

Most arguments are both positional and keyword.  The bare * will
support keyword-only, and you're asking for positional-only.  (An
argument which is neither positional nor keyword doesn't make sense.)

Today (except in extension code), an argument that isn't named only
appears courtesy of *args or **kwargs.

Today, named + keyword <==> defaulted

Today, arguments are not annotated.

Would it be acceptable if functions contained a (possibly implicit)
Signature object, and the way to get the odd combinations were through
modifying that?

For example:

    def unnamedargs(func):
        for arg in func.Signature:
        return func
        def write(self, s):


More information about the Python-3000 mailing list