Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!news2.euro.net!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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'classes.': 0.05; 'overridden': 0.09; 'am,': 0.12; 'class,': 0.15; 'attribute,': 0.16; 'creation.': 0.16; 'mro': 0.16; 'new-style': 0.16; 'cc:addr :python-list': 0.16; 'wrote:': 0.18; 'cheers,': 0.20; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; "shouldn't": 0.23; '\xa0if': 0.23; 'cc:2**0': 0.26; 'function': 0.27; 'message- id:@mail.gmail.com': 0.29; 'class': 0.29; 'cc:addr:python.org': 0.29; '(and': 0.30; 'kelly': 0.30; 'sun,': 0.30; 'url:library': 0.31; 'received:209.85.212': 0.33; 'stores': 0.34; 'probably': 0.35; 'url:python': 0.35; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'received:209.85': 0.38; 'url:org': 0.39; 'received:209': 0.39; "you'll": 0.61; 'provided': 0.62; '11,': 0.68; 'directly.': 0.68 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=7vhIzHECsW5ed7RJbmmqivTy21Ab1mkLOfO8KOxI+/M=; b=KtRYPuoSeh9e5qiYvJQgXvcXvG4bPzMhiI6Vv7pQGrX1hFwXUe9DgDNICLnialkebj tD56GmvDaXZ/lncadv9pRNKcmOauEPjCQHDHUWLd05KH801Ii2BC43oB4m0ZeNeFnglt whF0PTgtAtzI9cz83yq57NWH+YIv0yVccXNPuSY6sl21NDjQeGnHLPOOin12Uy04vmuu fKdwCJo/hVXoL2IwSY52XmH3db9tEylWLDPV/C4GZvnjVG9Rs+VU0WlDUSj0LinVGMYM TJcJ/jPCmzI+ZKnp5Ckw42Fwh7EJ70LvIqroRmSa1Q8avuGaOdCDdXk0YFlp2GMxTs2i 54Qw== MIME-Version: 1.0 In-Reply-To: References: <1c6db866-6fa3-4de5-96de-51d6720a1300@x17g2000yqj.googlegroups.com> <2feb13ca-f83b-4843-995f-ee77e7505ecd@db5g2000vbb.googlegroups.com> <18769501.3541.1331463388634.JavaMail.geo-discussion-forums@ynkz21> From: Ian Kelly Date: Sun, 11 Mar 2012 05:52:48 -0600 Subject: Re: newb __init__ inheritance To: hyperboogie Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1331466800 news.xs4all.nl 6939 [2001:888:2000:d::a6]:46477 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21492 On Sun, Mar 11, 2012 at 5:40 AM, Ian Kelly wrote: >> 2. Is the mro function available only on python3? > > No, but it is available only on new-style classes. =A0If you try it on a > classic class, you'll get an AttributeError. And by the way, you probably shouldn't call the mro method directly. That method is provided so that it can be overridden in order to customize the MRO at class creation. The proper (and faster) way to look up the MRO for a class is using the __mro__ attribute, which stores the result of the mro method when the class is initialized. http://docs.python.org/library/stdtypes.html?highlight=3Dmro#class.__mro__ Cheers, Ian