multiple inheritance from list and other class

88888 Dihedral dihedral88888 at googlemail.com
Sun Jan 8 01:08:22 EST 2012


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... at 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.  



More information about the Python-list mailing list