Care to explain classmethods and abc.abstractmethod in laymen terms... Like completely dumb it down.
A real life example would be nice
For further actions, you may consider blocking this person and/or reporting abuse
Care to explain classmethods and abc.abstractmethod in laymen terms... Like completely dumb it down.
A real life example would be nice
For further actions, you may consider blocking this person and/or reporting abuse
Mikhail Potapov -
Ben Halpern -
dev.to staff -
Helitha Rupasinghe -
Once suspended, mmphego will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, mmphego will be able to comment and publish posts again.
Once unpublished, all posts by mmphego will become hidden and only accessible to themselves.
If mmphego is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Mpho Mphego.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community safe. Here is what you can do to flag mmphego:
Unflagging mmphego will restore default visibility to their posts.
Top comments (4)
A class method is exactly what the name says: you have a class and the class has a method.
The difference between instance methods and class methods in Python is that the first ones operate on an instance of the class. Class methods operate on the class itself.
The main purpose of methods is to operate on state. Instance methods operate on the state of a single object, class methods operate on the class itself (they don't have access to the object) and they are also available to all objects of that class.
I think you can totally ignore the
abc
module in Python in the beginning (though I think you can almost always ignore it :)) unless you're interested in building contracts between callers and implementors. They might be useful in big architectures.abc.abstractmethod
basically means: "this method here is not a real implementation, I'm just saying to you that you need to override this method and provide an implementation when you use the base class I'm in".Now, this makes sense to me.
I've bookmarked this in case I need it again in future!
Thanks for the explanation, but still confused hahahahaha