Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed10.multikabel.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed5.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 X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:" ': 0.03; 'example:': 0.03; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subclasses': 0.09; 'def': 0.16; 'header:In-Reply-To:1': 0.22; 'here?': 0.23; 'pass': 0.28; 'correct': 0.29; 'class.': 0.29; 'parent': 0.30; 'class': 0.31; 'too': 0.32; 'rather': 0.33; 'to:addr:python-list': 0.34; 'header:X-Complaints-To:1': 0.34; 'header:User-Agent:1': 0.34; 'example,': 0.35; 'supposed': 0.35; 'could': 0.37; 'received:org': 0.38; 'subject:: ': 0.38; 'header :Mime-Version:1': 0.39; 'skip:s 20': 0.39; 'to:addr:python.org': 0.39; 'results': 0.62; 'direct': 0.66; 'here.': 0.66; 'elaborate': 0.84; 'schrieb': 0.84; 'spell': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Christian Heimes Subject: Re: Pipe in the "return" statement Date: Mon, 25 Jul 2011 18:11:07 +0200 References: <7064a3b1-2f5b-45e5-bf4f-57b62b4be457@gc8g2000vbb.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: smtp.semantics.de User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2.102ipre2 Thunderbird/3.1.11 In-Reply-To: <7064a3b1-2f5b-45e5-bf4f-57b62b4be457@gc8g2000vbb.googlegroups.com> X-Enigmail-Version: 1.1.2 OpenPGP: id=AD16AB1B; url=http://cheimes.de/heimes.asc X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1311610284 news.xs4all.nl 23916 [2001:888:2000:d::a6]:33601 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10285 Am 25.07.2011 17:28, schrieb Archard Lias: > It would be great if you could elaborate a little more on that. Am I > not supposed to access the parent here? You must spell out the parent explicitly, otherwise subclasses call super() with themselves rather than the correct parent class. self.__class__ is too dynamic here. Have a look at this example: class A(object): def method(self): pass class B(A): def method(self): super(self.__class__, self).method() class C(B): pass In this example, C().method() results in "super(C, self).method()" because self.__class__ is C. However that is wrong because you have to call super() with the direct parent. Christian