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

Newsgroups comp.lang.python
Date 2012-01-07 22:08 -0800
References <ea2fbcde-053b-4512-987a-564d9c9fd164@t13g2000yqg.googlegroups.com> <mailman.4521.1325986029.27778.python-list@python.org>
Subject Re: multiple inheritance from list and other class
From 88888 Dihedral <dihedral88888@googlemail.com>
Message-ID <mailman.4523.1326002905.27778.python-list@python.org> (permalink)

Show all headers | 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