আমি কিছু ত্রুটি পেয়েছি যা আমি বুঝতে পারি না। আমার স্যাম্পল কোডটিতে কী ভুল আছে তা সম্পর্কে কোনও সূত্র?
class B:
def meth(self, arg):
print arg
class C(B):
def meth(self, arg):
super(C, self).meth(arg)
print C().meth(1)
আমি 'সুপার' অন্তর্নির্মিত পদ্ধতির সাহায্যে নমুনা পরীক্ষার কোড পেয়েছি।
ত্রুটি এখানে:
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
এফওয়াইআই, অজগর থেকে নিজেই এখানে সহায়তা (সুপার) দিচ্ছেন:
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)
|