in python there is way to declare def‘s without putting it in class. So, if i just need to store many def‘s in separated class, i should simple do this:
def first_method():
pass
def second_method():
pass
and not use @classmethod or @staticmethod?:
class methods():
@classmethod
def first_method(cls):
pass
@staticmethod
def second_method():
pass
if first way is right, how should i mark private and public method?
Yes. Just keep functions that are not instance methods out of your classes.
You’re thinking like you would in Java. Python isn’t Java. Python has no true way to have public and private methods — you can change the names to indicate that you’d like some form of privacy (
_or__at the beginning of the name), but it’s not enforceable.I’ve found that in all the time I’ve programmed in Python, I never wished for access modifiers.