Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18662

Re: multiple inheritance from list and other class

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <dihedral88888@googlemail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.043
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'python': 0.08; 'reply- to:addr:comp.lang.python': 0.09; 'to:addr:comp.lang.python': 0.09; 'error:': 0.10; '8bit%:72': 0.16; 'b()': 0.16; 'container.': 0.16; 'declaring': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'arguments': 0.18; 'jan': 0.19; 'cc:no real name:2**0': 0.20; 'subject:list': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'produces': 0.23; 'subject:other': 0.23; 'defined': 0.24; 'cc:2**0': 0.24; 'posted': 0.25; 'code': 0.25; 'classes': 0.26; 'van': 0.28; 'fine.': 0.29; 'cc:addr:python.org': 0.29; 'error': 0.29; 'pm,': 0.29; 'class': 0.29; 'sun,': 0.30; 'typeerror:': 0.30; 'chris': 0.30; 'version': 0.32; 'quite': 0.32; 'list': 0.32; 'actual': 0.32; 'header:User-Agent:1': 0.33; 'actually': 0.33; 'object': 0.33; 'match': 0.34; 'from:addr:googlemail.com': 0.34; 'question,': 0.34; 'received:209.85.212': 0.34; 'too': 0.34; 'all.': 0.34; 'post': 0.36; 'properties': 0.36; 'minimal': 0.37; 'hello,': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'subject:from': 0.38; '(with': 0.39; 'received:209': 0.40; 'your': 0.61; '2012': 0.67; 'header:Reply-To:1': 0.71; 'reply- to:no real name:2**0': 0.72; 'bodies': 0.73; 'reply- to:addr:googlegroups.com': 0.74; '12:16': 0.84; 'derive': 0.84; 'troubles': 0.84; 'received:209.85.212.56': 0.91; 'received:mail- vw0-f56.google.com': 0.91; 'skip:2 50': 0.91
Newsgroups comp.lang.python
Date Sat, 7 Jan 2012 22:08:22 -0800 (PST)
In-Reply-To <mailman.4521.1325986029.27778.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=1.168.129.93; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw
References <ea2fbcde-053b-4512-987a-564d9c9fd164@t13g2000yqg.googlegroups.com> <mailman.4521.1325986029.27778.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
MIME-Version 1.0
Subject Re: multiple inheritance from list and other class
From 88888 Dihedral <dihedral88888@googlemail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To comp.lang.python@googlegroups.com
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.4523.1326002905.27778.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1326002905 news.xs4all.nl 6860 [2001:888:2000:d::a6]:40421
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18662

Show key headers only | View raw


A list is a container. 


Chris Angelico於 2012年1月8日星期日UTC+8上午9時27分06秒寫道:
> On Sun, Jan 8, 2012 at 12:16 PM, lars van gemerden <la...@rational-it.com> wrote:
> > Hello,
> >
> > I have an error message i do not understand:
> >
> > My code is in essence:
> >
> > b = B([1,2,3,4])
> >
> > error:
> >    b = B([0,1,2,3,4])
> > TypeError: B() takes exactly 2 arguments (1 given)
> 
> Your code doesn't quite match your error message, and the code as
> posted (with 'pass' in the method bodies to make it compile) works
> fine. Can you derive a minimal test-case that actually produces the
> error in question, and then post the actual code and error? Also -
> what version of Python are you using?
> 
> Chris Angelico

The class is defined in a silly way. 
In python declaring a class with only trivial properties added is 
not very python at all.

Just let an object obtain new properties to save the troubles of 
deriving a lot classes not different too much.  

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

multiple inheritance from list and other class lars van gemerden <lars@rational-it.com> - 2012-01-07 17:16 -0800
  Re: multiple inheritance from list and other class Chris Angelico <rosuav@gmail.com> - 2012-01-08 12:27 +1100
    Re: multiple inheritance from list and other class 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-07 22:08 -0800
    Re: multiple inheritance from list and other class 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-07 22:08 -0800
      Re: multiple inheritance from list and other class Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-08 06:41 +0000
  Re: multiple inheritance from list and other class Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-08 06:42 +0000
    Re: multiple inheritance from list and other class lars van gemerden <lars@rational-it.com> - 2012-01-08 02:48 -0800

csiph-web