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

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to