Deciding to use class itself or class method

Viewed 39

I just wondering which way is the most efficient (or pythonic) for accessing statically defined methods inside a method. Let me clear my question.

class ExampleClass:
    @staticmethod
    def do_something():
        pass

    @staticmethod
    def do_anohter_thing():
        pass

I want to call do_something inside of the do_anohter_thing. Should I use @classmethod or the class itself(ExampleClass)?

class ExampleClass:
    @staticmethod
    def do_something():
        pass

    @classmethod
    def do_anohter_thing(cls):
        cls.do_something()

or

class ExampleClass:
    @staticmethod
    def do_something():
        pass

    @staticmethod
    def do_anohter_thing():
        ExampleClass.do_something()
0 Answers
Related