Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.04; 'classes.': 0.05; 'hettinger': 0.07; 'python': 0.07; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:gator410.hostgator.com': 0.09; '~ethan~': 0.09; 'written': 0.12; 'examples': 0.12; 'wrote:': 0.14; "django's": 0.16; 'explicitely': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'received:gateway01.websitewelcome.com': 0.16; 'testcase': 0.16; 'testcases': 0.16; 'class,': 0.16; 'classes,': 0.19; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'header:In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'raymond': 0.22; 'example': 0.24; 'calling': 0.25; 'wrote': 0.25; 'expect': 0.26; "i'm": 0.26; "i'll": 0.26; 'classes': 0.26; 'work.': 0.27; 'class': 0.29; 'cc:addr:python.org': 0.31; 'however,': 0.31; 'called': 0.32; '...': 0.32; 'using': 0.34; 'header:User-Agent:1': 0.35; 'point': 0.35; 'guidance': 0.35; 'some': 0.37; 'thread': 0.38; 'but': 0.38; 'listed': 0.39; 'how': 0.39; 'would': 0.40; 'header:Received:5': 0.40; 'act': 0.61; 'give': 0.61; 'received:hostgator.com': 0.64; 'received:websitewelcome.com': 0.71; 'python-dev': 0.84; 'cooperative': 0.91; 'received:69.93': 0.91 Date: Wed, 04 May 2011 11:36:51 -0700 From: Ethan Furman User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: Raymond Hettinger Subject: Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance References: <89b6d53f-dcdc-4442-957f-1f4d29115a26@n32g2000pre.googlegroups.com> In-Reply-To: <89b6d53f-dcdc-4442-957f-1f4d29115a26@n32g2000pre.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator410.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-Source: X-Source-Args: X-Source-Dir: 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: 29 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1304533517 news.xs4all.nl 41110 [::ffff:82.94.164.166]:52570 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:4641 Raymond Hettinger wrote: > I'm writing-up more guidance on how to use super() and would like to > point at some real-world Python examples of cooperative multiple > inheritance. Don't know if you are still looking for examples, but I recently came across a thread in Python-Dev which had an example using unittest: Ricardo Kirkner wrote [much snippage]: > I'll give you the example I came upon: > > I have a TestCase class, which inherits from both Django's TestCase > and from some custom TestCases that act as mixin classes. So I have > something like > > class MyTestCase(TestCase, Mixin1, Mixin2): > ... > > Since I explicitely base off 3 classes, I expected all 3 > classes to be initialized, and I expect the setUp method to be called > on all of them. As written this example failed because TestCase (from django) was based on unittest2.TestCase, which was not calling super. I understand, however, that if the mixins were listed before TestCase that it would work. Hope this helps. ~Ethan~