aahz at panix.com
Fri Feb 9 16:40:21 CET 2001
In article <96059d$din$1 at news.mathworks.com>,
Joshua Marshall <jmarshal at mathworks.com> wrote:
>Still this is a different issue than lexical scoping. Consider:
> class T:
> def m(self):
> print self.x
> T.x = 'foo'
>Here, T().m() prints "foo". Lexically, x is not defined in m's scope.
>I believe it was a good decision to require going through self to
>access class/object fields.
Note that you don't necessarily want to go through self to access class
fields. Here you're relying on the search through the class hierarchy
to access T.x with self.x. (I'm pretty sure you know this, but I don't
want any newcomers getting confused.)
--- Aahz (Copyright 2001 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
"Actually, I've found that Usenet has helped a lot with my terror of
social stupidity. Seeing people I really like and respect behave like
idiots in public has been very beneficial." --Rachael Lininger
More information about the Python-list