Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76780
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <elearn2014@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.026 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'attribute': 0.07; '*args,': 0.09; 'subject:method': 0.09; 'def': 0.12; '**kwargs)': 0.16; '**kwargs):': 0.16; 'example?': 0.16; 'name):': 0.16; 'subject:when': 0.16; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'instance,': 0.24; 'subject:will': 0.24; 'skip:_ 20': 0.27; 'class': 0.32; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'received:google.com': 0.35; 'method': 0.36; 'subject:?': 0.36; 'received:10': 0.37; 'skip:o 20': 0.38; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'called': 0.40; 'subject: ': 0.61; 'name': 0.63; 'chance': 0.65; 'x):': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=6a6Brc5m3ToDAOsjUvCJVAMOqF5A8M3CstoJzXjbj3A=; b=E6DZVYwytf1RL2lhszH2He9lxJLPkzIHaCg5z6zj8M57YTaOXkzKDiWmyWGBtkbvyZ YQcXrZqUMbhzylIUEs7jO6RpHiAggL8G9/XxlbrUrai6oioOl2xcizZa6DxCQx1qGmp/ 5shiPe8O5YSmy0y1r64uhS4u5jdMQ7sI/TJYsLYT5xCdpnKNXjIlzPIrjg0sXj5vm1Mb GWehCBxIdibDZCvcLowp7anJK9LGWw2FWrD9FP17BuJjjq+I8/rYDbww1r9O4UYhLfLi HngwRuXFKHPx/Jw7P9BlSp7t4TlQ+m8HOgUz/7xwPkDfPuYkoByRzMs6HVHhFCnujiaY 32wA== |
| X-Received | by 10.70.137.1 with SMTP id qe1mr3985343pdb.159.1408691329928; Fri, 22 Aug 2014 00:08:49 -0700 (PDT) |
| Date | Fri, 22 Aug 2014 15:08:25 +0800 |
| From | luofeiyu <elearn2014@gmail.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | when the method __get__ will be called? |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13278.1408691339.18130.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1408691339 news.xs4all.nl 2916 [2001:888:2000:d::a6]:57338 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:76780 |
Show key headers only | View raw
class C(object):
a = 'abc'
def __getattribute__(self, *args, **kwargs):
print("__getattribute__() is called")
return object.__getattribute__(self, *args, **kwargs)
def __getattr__(self, name):
print("__getattr__() is called ")
return name + " from getattr"
def __get__(self, instance, owner):
print("__get__() is called", instance, owner)
return self
def foo(self, x):
print(x)
>>> x=C()
>>> x.a
__getattribute__() is called
'abc'
>>> x.b
__getattribute__() is called
__getattr__() is called
'b from getattr'
If call an attribute which does exist ,__getattribute__() is called
If call an attribute which does not exist ,__getattribute__() is called
and then __getattr__() is called ?
when the __get__ method will be called?no chance for my example?
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
when the method __get__ will be called? luofeiyu <elearn2014@gmail.com> - 2014-08-22 15:08 +0800 Re: when the method __get__ will be called? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-22 17:30 +1000
csiph-web