Variables visibility for methods
dieter
dieter at handshake.de
Wed Aug 31 04:03:02 EDT 2016
"ast" <nomail at com.invalid> writes:
> ...
> So it seems that when an object's méthod is executed, variables
> in the scope outside the object's class can be read (2nd example),
> but not variables inside the class (1st example).
>
> For 1st example, I know that print(MyClass.a) or print(self.a)
> would have work.
>
> Any comments are welcome.
You are right. And it is documented this way.
More information about the Python-list
mailing list