class ClassName(OtherClass):means that ClassName inherits from OtherClass. inheritance is a big subject but basically it means that ClassName has at least the same functions and fields as OtherClass.In python, Everything is an object and therefor, all classes inherit implicitely or explicitely from object. This being said
the
class ClassName():declaration is an old syntax and should be avoided.class ClassName:is equivalent to classClassName(object):A class method is not a static method. It is like any other instance method except it is passed the class as parameter rather than the instance.
Your class method declaration is wrong. It should have a cls parameter.
A static method in the other hand, is a method that is called out of context. Meaning it has no relation with any instance. It can be thought of as a independent function that is simply put in a class for semantic reasons.
This is why it does not require a self parameter and one is never passed to it.
You have an indentation error. That might be causing the error.
Your class method declaration is wrong. It should have a cls parameter.
- A static method in the other hand, is a method that is called out of context. Meaning it has no relation with any instance. It can be thought of as a independent function that is simply put in a class for semantic reasons.
This is why it does not require a self parameter and one is never passed to it.
- You have an indentation error. That might be causing the error.
class ClassName(OtherClass):means that ClassName inherits from OtherClass. inheritance is a big subject but basically it means that ClassName has at least the same functions and fields as OtherClass.In python, Everything is an object and therefor, all classes inherit implicitely or explicitely from object. This being said
the
class ClassName():declaration is an old syntax and should be avoided.class ClassName:is equivalent to classClassName(object):A class method is not a static method. It is like any other instance method except it is passed the class as parameter rather than the instance.
Your class method declaration is wrong. It should have a cls parameter.
- A static method in the other hand, is a method that is called out of context. Meaning it has no relation with any instance. It can be thought of as a independent function that is simply put in a class for semantic reasons.
This is why it does not require a self parameter and one is never passed to it.
- You have an indentation error. That might be causing the error.
class ClassName(OtherClass):means that ClassName inherits from OtherClass. inheritance is a big subject but basically it means that ClassName has at least the same functions and fields as OtherClass.In python, Everything is an object and therefor, all classes inherit implicitely or explicitely from object. This being said
the
class ClassName():declaration is an old syntax and should be avoided.class ClassName:is equivalent to classClassName(object):A class method is not a static method. It is like any other instance method except it is passed the class as parameter rather than the instance.
Your class method declaration is wrong. It should have a cls parameter.
A static method in the other hand, is a method that is called out of context. Meaning it has no relation with any instance. It can be thought of as a independent function that is simply put in a class for semantic reasons.
This is why it does not require a self parameter and one is never passed to it.
You have an indentation error. That might be causing the error.
class ClassName(OtherClass):means that ClassName inherits from OtherClass. inheritance is a big subject but basically it means that ClassName has at least the same functions and fields as OtherClass.In python, Everything is an object and therefor, all classes inherit implicitely or explicitely from object. This being said
the
class ClassName():declaration is an old syntax and should be avoided.class ClassName:is equivalent to classClassName(object):A class method is not a static method. It is like any other instance method except it is passed the class as parameter rather than the instance.
Your class method declaration is wrong. It should have a cls parameter.
- A static method in the other hand, is a method that is called out of context. Meaning it has no relation with any instance. It can be thought of as a independent function that is simply put in a class for semantic reasons.
This is why it does not require a self parameter and one is never passed to it.
- You have an indentation error. That might be causing the error.