Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41854 > unrolled thread

At a loss on python scoping.

Started byShiyao Ma <i@introo.me>
First post2013-03-26 14:17 +0800
Last post2013-03-26 14:17 +0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  At a loss on python scoping. Shiyao Ma <i@introo.me> - 2013-03-26 14:17 +0800

#41854 — At a loss on python scoping.

FromShiyao Ma <i@introo.me>
Date2013-03-26 14:17 +0800
SubjectAt a loss on python scoping.
Message-ID<mailman.3716.1364278650.2939.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

Hi,
suppose I have a file like this:
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

a.func(3)
print(a.s)    # this should print 3, also where does py store this name.
what's the underlying difference between the above example?


-- 
My gpg pubring is available via: gpg --keyserver
subkeys.pgp.net--recv-keys 307CF736

More on: http://about.me/introom

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web