At a loss on python scoping.

Chris Angelico rosuav at gmail.com
Tue Mar 26 07:29:04 CET 2013


On Tue, Mar 26, 2013 at 5:17 PM, Shiyao Ma <i at introo.me> wrote:
> class A:
>     r = 5
>     def func(self, s):
>         self.s = s
> a = A()
> print(a.r)    # this should print 5, but where does py store the name of r

What do you mean by "the name of r"?

ChrisA



More information about the Python-list mailing list