0

Is there a way to make a method only available inside a class? (For use inside other methods only)

class Example:

    def __init__(self, ...):
        ...

    def innermethod(self, ...):
        print("Hello World")

    def somemethod(self, ...):
        # This should work
        self.innermethod()


x = Example()

# This should not work
x.innermethod()
darragh
  • 11
  • 4

0 Answers0