Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41856
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <i@introo.me> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.019 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'static': 0.04; 'suppose': 0.07; '(aka': 0.09; 'received:209.85.219': 0.09; 'def': 0.12; 'a()': 0.16; 'example?': 0.16; 'gpg': 0.16; 'lexical': 0.16; 'subject:loss': 0.16; 'underlying': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; "python's": 0.19; 'print': 0.22; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'file': 0.32; 'class': 0.32; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'hi,': 0.36; 'should': 0.36; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'url:about': 0.61; 'name': 0.63; 'more': 0.64; 'between': 0.67; 'mar': 0.68; '26,': 0.68; 'url:me': 0.69; '2013': 0.98 |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:x-originating-ip:in-reply-to:references :date:message-id:subject:from:to:content-type:x-gm-message-state; bh=rCGnpV4KFfPPTcdaTRmISPYWX30P01MtyvqnwKagw/I=; b=OtGm2IB7i5wAtwW2+jb5rheYbwxQjjh9hauF0oDaLiC9b49Ybk0LS8RvuAdxPGbyfn EjQqHkt21wL9tSPhTBgQPKRbYGfVMxRg6lmbfDiIHgcHB9ZQVQPV6k9LZX1j7yswNMtS AiPNrQUr7pXE5eYsZhQiDswguCROYVtVilN+FscTCyXvpRLoCBvtv9VdR9p9Biy0NI6S spCdLWFx2fVoLSrQhepV6xSFUmLsfle7Ipk/XQX0MXwwZHUtXOhIF7PSYf9RDzPrTH2F tM+geon+n0W//T9PmOl5njQWw6edlsFogJ1G6o6e/BPTmMGXSlKD3c/sMY7wxjsXY1Y7 iYUA== |
| MIME-Version | 1.0 |
| X-Received | by 10.60.32.198 with SMTP id l6mr13324745oei.27.1364278761601; Mon, 25 Mar 2013 23:19:21 -0700 (PDT) |
| X-Originating-IP | [202.112.3.7] |
| In-Reply-To | <CAJQX3DyT53ocRcxW+1+xRWON2wzoAwEEkEO-zFTXBRm_v5KCOQ@mail.gmail.com> |
| References | <CAJQX3DyT53ocRcxW+1+xRWON2wzoAwEEkEO-zFTXBRm_v5KCOQ@mail.gmail.com> |
| Date | Tue, 26 Mar 2013 14:19:21 +0800 |
| Subject | Re: At a loss on python scoping. |
| From | Shiyao Ma <i@introo.me> |
| To | python-list@python.org |
| Content-Type | multipart/alternative; boundary=e89a8fb201baf5cec404d8cde6be |
| X-Gm-Message-State | ALoCoQnUewyQjD2mqioeKln9HbLVJOs4QoPetAxPA0AAp65fgCWECqGD7WQSnhbvDDk1z66QmMVf |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3718.1364278769.2939.python-list@python.org> (permalink) |
| Lines | 70 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1364278769 news.xs4all.nl 6881 [2001:888:2000:d::a6]:60454 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:41856 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
PS, I now python's scoping rule is lexical rule (aka static rule). How does LEGB apply to class? On Tue, Mar 26, 2013 at 2:17 PM, Shiyao Ma <i@introo.me> wrote: > 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 > > -- My gpg pubring is available via: gpg --keyserver subkeys.pgp.net--recv-keys 307CF736 More on: http://about.me/introom
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: At a loss on python scoping. Shiyao Ma <i@introo.me> - 2013-03-26 14:19 +0800 Re: At a loss on python scoping. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-26 12:43 +0000
csiph-web