C-like assignment expression?

Hrvoje Niksic hniksic at xemacs.org
Wed May 21 07:47:59 EDT 2008


Bruno Desthuilliers <bruno.42.desthuilliers at websiteburo.invalid>
writes:

> The canonical solution is to iterate over a list of
> expression,function pairs, ie:

Although that solution is pretty, it is not the canonical solution
because it doesn't cover the important case of "if" bodies needing to
access common variables in the enclosing scope.  (This will be easier
in Python 3 with 'nonlocal', though.)  The snippet posted by Diez is
IMHO closer to a canonical solution to this FAQ.



More information about the Python-list mailing list