[Python-3000] sets in P3K?

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sat Apr 29 18:13:59 CEST 2006


Nick Coghlan <ncoghlan at gmail.com> writes:

> If we change that, we can use it to support an alternate invocation
> syntax for functions that currently expect an iterable as their
> first argument. "EXPR{ARGS}" would be equivalent to "EXPR((ARGS,))",
> with the following differences in the parsing of ARGS:
>     x:y would be permitted, and map to a 2-tuple (x, y)
>     x:y:z would be permitted, and map to a 3-tuple (x, y, z)
>     x=y would be permitted, and map to a 2-tuple ('x', y)
>     *x would be permitted, and would extend the passed in tuple with x

I like it. A disadvantage is that there are now three families
contexts where comma-separated sequences of exprssions appear,
with slightly different rules:
a) tuples and lists
b) function arguments
c) EXPR{ARGS}
where e.g. x=y has a different meaning in each.

Perhaps unifying a) with c) would be better, i.e. allow the above
syntactic features in tuples and lists too.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


More information about the Python-3000 mailing list