Difference between staticmethod and classmethod

后端 未结 28 2194
一整个雨季
一整个雨季 2020-11-21 06:11

What is the difference between a function decorated with @staticmethod and one decorated with @classmethod?

28条回答
  •  面向向阳花
    2020-11-21 06:51

    Basically @classmethod makes a method whose first argument is the class it's called from (rather than the class instance), @staticmethod does not have any implicit arguments.

提交回复
热议问题