On 8/14/06, Steven Bethard <[EMAIL PROTECTED]> wrote:
> On 8/14/06, Guido van Rossum <[EMAIL PROTECTED]> 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:

    positional
    keyword
    named
    defaulted
    annotated

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:
            arg.name=None
        return func
...
        @unnamedargs
        def write(self, s):


-jJ
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to