On 4/23/06, Talin <[EMAIL PROTECTED]> wrote: >... you can't just do it for a single argument in isolation. You > have no idea where any positional argument is going to > go until all keyword arguments have been placed, and > until all previous positional arguments have > been placed.
Yes you do. All positional arguments go to the first (length of positional arguments) arguments, in exactly that order. If there are leftoevers, they go to *args. If there is a shortage, then the ones at the end are not filled by positional. Then the remaining keyword arguments are filled (or allowed to default). If any remaining keyword attempts to name one of the positional arguments that was already filled, a SyntaxError or TypeError is raised. >>> def f(a, b, c=5): print a, b ,c >>> f(26,a=6) # enough arguments, but a is positional Traceback (most recent call last): File "<pyshell#3>", line 1, in -toplevel- f(26,a=6) TypeError: f() got multiple values for keyword argument 'a' >>> f(b=15, 4,3) # and the first argument *must* be first SyntaxError: non-keyword arg after keyword arg -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