[Python-3000] Type Expressions

Sam Pointon free.condiments at gmail.com
Sat Apr 22 14:44:30 CEST 2006


On 22/04/06, Paul Svensson <paul-python at svensson.org> wrote:
> At the risk of hypergeneralization...  If *arg means "put the rest of the
> positional arguments in arg", then if we simply allow arg to be a tuple...
>
> def foo(*(a, b)): ...           # disallow keyword args.
> def foo(a, b, *(), x, y): ...   # disallow positional args after b.
> def foo(*(a, b), x, y): ...     # a, b _must_ be positional; x, y keyword.
>
> That () = () is currently a syntax error might be considered a reason to
> use the lone star spelling instead of *(), but I find the tuple more obvious.

This is close (ish) to the "def [positional-only arguments](mixed
arguments){keyword-only arguments}" syntax I floated earlier, which
Guido then promptly rejected. It looks like we won't get a way to
force an argument to be given positionally, as he's also already
voiced a distaste for nested bracketing in argument lists.

--Sam


More information about the Python-3000 mailing list