Newbie scopes question

Keith Jones kjones at docstrategies.com
Thu Feb 28 14:42:17 EST 2002


I do believe it will work for you if you change the line

 > print attribute

to

> print self.attribute

you need to tell python that attribute is a member variable. Otherwise, py
will think it's a local var, or failing that, a global var; and of course,
in your case. attribute doesn't exist in either of those scopes.

Hope that clears things up.

--

Keith Jones
http://www.codeexamples.org





More information about the Python-list mailing list