multiple inheritance from list and other class

lars van gemerden lars at rational-it.com
Sat Jan 7 20:16:22 EST 2012


Hello,

I have an error message i do not understand:

My code is in essence:

class A(object):
#no __new__ or __init__
    def meth1(self, args):
        #some code
    def meth2(self, args):
        #some code

class B(list, A)
    pass

b = B([1,2,3,4])

error:

Traceback (most recent call last):
  File "D:\Documents\Code\Eclipse\workspace\FlowTools\iteraids.py",
line 431, in <module>
    testolist()
  File "D:\Documents\Code\Eclipse\workspace\FlowTools\iteraids.py",
line 381, in testolist
    b = B([0,1,2,3,4])
TypeError: B() takes exactly 2 arguments (1 given)

(adapted the error to the example classes)

Can anyone help/explain?

Cheers, Lars






More information about the Python-list mailing list