Calling a class method raises a TypeError in Python

前端 未结 8 671
小鲜肉
小鲜肉 2020-12-04 16:02

I don\'t understand how classes are used. The following code gives me an error when I try to use the class.

class MyStuff:
    def average(a, b, c): # Get th         


        
8条回答
  •  隐瞒了意图╮
    2020-12-04 16:38

    In python member function of a class need explicit self argument. Same as implicit this pointer in C++. For more details please check out this page.

提交回复
热议问题