[Python-Dev] Py3k: Except clause syntax
Gareth McCaughan
gmccaughan at synaptics-uk.com
Mon Mar 20 07:00:02 CET 2006
On Friday 2006-03-17 05:04, Alex Martelli wrote:
> Hmmm, if we allowed '(<expr> as <var>)' for generic expr's we'd make
> a lot of people pining for 'assignment as an expression' very happy,
> wouldn't we...?
I hope not. It looks a lot more like a binding construct
than an assigning one. But what about "pattern-matching"?
Currently, you can say
def f((x0,y0), (x1,y1)):
...
but wouldn't if be nice if you could say
def f((x0,y0) as p0, (x1,y1) as p1):
...
and have both the "packed" and "unpacked" forms
available? (Prior art: some functional languages
that let you define a function with multiple
"pattern-matching" clauses have a similar feature.)
--
g
More information about the Python-Dev
mailing list