Why no lexical scoping for a method within a class?
walterbyrd
walterbyrd at iname.com
Wed Dec 17 13:27:35 EST 2008
On Dec 17, 8:41 am, prueba... at latinmail.com wrote:
> If scoping worked as you want, how, pray tell, would you define object
> attributes?- Hide quoted text -
I suppose you could do this:
class className():
varname = "whatever"
def fname(self, varname):
. . . .
Instead of having variable defined within methods to be global
everywhere within the class.
Anyway, it's not a matter of what I like, I am just trying to
understand the reason behind the scoping rules.
More information about the Python-list
mailing list