if/elif chain with assignment expressions
Paul Rubin
http
Sun Jul 11 23:10:17 EDT 2004
"Neil Hodgson" <nhodgson at bigpond.net.au> writes:
> Pruning the possible cause tree is extremely valuable and Python
> cooperates with a well thought out set of restrictions.
If you're trying to add restrictions to prune a cause tree, how about
starting with private instance variables in classes and modules
instead of the silly underscore name mangling hack. Maybe you can
also do something about scoping madness:
def f():
p = 3
def g():
p = 4
print 'g',p
g()
print 'f',p
f()
There's no way in g to set f's variable called 'p', which defeats the
purpose of nested functions as generally used since the days of Algol-60.
> Being able to depend on the absence of assignments in if and while
> statements is a benefit when fixing Python code over C/C++.
Not if it makes the code more complicated and bug-prone.
More information about the Python-list
mailing list