[Python-3000] Type Expressions

Paul Svensson paul-python at svensson.org
Sat Apr 22 03:48:11 CEST 2006


On 4/21/06, Talin <talin at acm.org> wrote:
> Guido van Rossum <guido <at> python.org> writes:
>
>> To prevent more abominations like this, let me pronounce that I now
>> like the single-star syntax:
>>
>>   def foo(a, b, *, x=1, y=2): ...
>
> Thank you :) It was getting pretty strange there.
>
> The variation that I was thinking of was a little shorter, but not
> necessarily better:
>
>    def foo( a, b; x=1, y=2 ): ...

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.

 	/Paul


More information about the Python-3000 mailing list