What is the correct way of structuring private methods that are going to be called inside a classmethod? There is such a thing as a private classmethod?
class Foo:
def _bar(self):
# do something
@classmethod
def bar(cls):
cls._bar()
>> Foo.bar()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 7, in bar
TypeError: unbound method _bar() must be called with Foo instance as first argument (got nothing instead)
Aucun commentaire:
Enregistrer un commentaire