Dostaję błąd, którego nie mogę znaleźć. Jakąkolwiek wskazówkę co jest nie tak z moim przykładowym kodem?super() kończy się niepowodzeniem z błędem: TypeError "argument 1 musi być typem, a nie classobj"
class B:
def meth(self, arg):
print arg
class C(B):
def meth(self, arg):
super(C, self).meth(arg)
print C().meth(1)
Dostałem próbny kod testowy z pomocą "super" wbudowanej metody. Klasa "C" jest
Tutaj jest błąd:
Traceback (most recent call last):
File "./test.py", line 10, in ?
print C().meth(1)
File "./test.py", line 8, in meth
super(C, self).meth(arg)
TypeError: super() argument 1 must be type, not classobj
FYI, tutaj jest pomoc (super) z pytona samego:
Help on class super in module __builtin__:
class super(object)
| super(type) -> unbound super object
| super(type, obj) -> bound super object; requires isinstance(obj, type)
| super(type, type2) -> bound super object; requires issubclass(type2, type)
| Typical use to call a cooperative superclass method:
| class C(B):
| def meth(self, arg):
| super(C, self).meth(arg)
|
możliwy duplikat [python super() podnosi TypeError! Dlaczego?] (Http://stackoverflow.com/questions/489269/python-super-raises-typeerror-why) – user
Meth ?? Czy to termin programowania, czy ... no wiesz? Proszę o wyjaśnienie. – Cplusplusplus
@Cplusplusplus: prawdopodobnie oznacza Method ;-) – ShadowFlame