Nick Coghlan wrote:

[...]

> If the right hand side of 'as' permitted the same forms as are going 
> to be permitted for the 'as' clause in 'with' statements, then Ralf's 
> situation could be handled via:
> 
>    def __init__(self as s, x as s.x, y as s.y, z as s.z):
>       pass
> 
> Essentially, it allows arguments to be given two names - a public name 
> (before the 'as', used for keyword arguments), and a private name 
> (after the 'as', not used for keyword arguments, allows easy shorthand 
> aliasing of self, unpacking of tuple arguments, and easy assignment of 
> instance variables).

There once was a suggestion like this on c.l.py, expanding this to other
statements, like:

if re.match('a.*b', text) as m:
    # do something

What has become of this? It seems to be a wanted feature, and while I concur
that classic 'C-style' assignment-as-expression is undesirable (because of
the =/== bug-source), this would be a way, wouldn't it?

Reinhold

-- 
Mail address is perfectly valid!

_______________________________________________
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