Christopher J. Bottaro wrote:
Why don't this code work?

import PRI

class Poscdnld_PYIO(PRI.BasicBatch):
def __init__(self, *argv):
super(Poscdnld_PYIO, self).__init__(*argv)


x = Poscdnld_PYIO()

I get this exception:
File "poscdnld_pyio.py", line 52, in __init__
    super(Poscdnld_PYIO, self).__init__(*argv)
TypeError: super() argument 1 must be type, not classobj

What am I doing wrong?  Thanks.


I don't know what PRI is, but I suspect that PRI.BasicBatch is a classic class, not a new-style class. The super function only works for new-style classes:


>>> class C:
...     def __init__(self):
...         super(C, self).__init__()
...
>>> c = C()
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "<interactive input>", line 3, in __init__
TypeError: super() argument 1 must be type, not classobj
>>> class C(object):
...     def __init__(self):
...         super(C, self).__init__()
...
>>> c = C()
>>>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to