Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=python.org; s=200901; t=1410094997; bh=t4esOuNrII4LI/XcygO/QQixbqIXlfJ5WYgqvWpXoPk=; h=To:From:Subject:Date:References:From; b=GDTO/5Fz2Dn30MUgBkMAgougbOlM/eTtnytRIk3uK5hgt5nqN+/vcgUGB6lIsBYUm KxHD4yxT4Ujh/g6DCL1W3hBcfT4xW26Lieu3jld80d1ej6NSwK2tfbE2xyRnlR0HJ/ 6nJpHIWmXXBEfzuxo2TzRA/Od8Q+xQ7krBhaWFH4= X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'notice,': 0.07; 'constructor': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.12; '(none,': 0.16; 'corresponds': 0.16; 'dig': 0.16; 'from:name:antoine pitrou': 0.16; 'message-id:@post.gmane.org': 0.16; 'object).': 0.16; 'received:213.41.240': 0.16; 'received:213.41.240.54': 0.16; 'received:80.91.229.3': 0.16; 'received:charlus.yi.org': 0.16; 'received:plane.gmane.org': 0.16; 'received:yi.org': 0.16; 'subject:3.3': 0.16; 'subject:python': 0.16; 'from:addr:python.org': 0.16; '>>>': 0.22; 'header:User- Agent:1': 0.23; "shouldn't": 0.24; 'second': 0.26; 'pass': 0.26; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; '(which': 0.31; 'code': 0.31; "skip:' 10": 0.31; 'writes:': 0.31; 'class': 0.32; 'checked': 0.32; 'skip:- 30': 0.32; 'implemented': 0.33; 'skip:_ 10': 0.34; 'definition': 0.35; 'more,': 0.35; 'test': 0.35; 'method': 0.36; 'charset:us-ascii': 0.36; 'hi,': 0.36; 'wrong': 0.37; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'fact': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'future': 0.60; 'subjectcharset:utf-8': 0.72; 'antoine.': 0.84; 'internally.': 0.84; 'subject::': 0.85 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Antoine Pitrou Subject: Re: =?utf-8?b?X19xdWFsbmFtZV9f?= in python 3.3 Date: Sun, 7 Sep 2014 13:03:04 +0000 (UTC) References: <540b3293$0$2056$426a74cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 213.41.240.54 (Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410094999 news.xs4all.nl 2832 [2001:888:2000:d::a6]:51853 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77670 Hi, ISE Development gmail.com> writes: > 'code' object 'function' object > ---------------- ------------------------------------ > co_name: test __qualname__: test > co_name: T __qualname__: T > co_name: method __qualname__: test..T.method > > The second call corresponds to the class definition and not the call to the > constructor (which is in fact a call to 'object.__init__', a C function > hence not traced as a 'call' event - I checked this by disassembling the > code object). There's nothing wrong here. That's just the way things are implemented internally. This may change in the future without prior notice, so you shouldn't rely on it. If you want to dig more, you have to look at how the hidden function ("T") works: >>> def f(): ... class T: pass ... >>> f.__code__.co_consts (None, ", line 2>, 'T') >>> dis.dis(f.__code__.co_consts[1]) 2 0 LOAD_NAME 0 (__name__) 3 STORE_NAME 1 (__module__) 6 LOAD_CONST 0 ('f..T') 9 STORE_NAME 2 (__qualname__) 12 LOAD_CONST 1 (None) 15 RETURN_VALUE Regards Antoine.