Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Sidestepping the issue of whether action should be part of the class, action could be defined as a static method (@staticmethod def action(func)...). Commented Jan 27, 2014 at 14:09
  • @chepner: sure, but that doesn't make the static method any more useful. Commented Jan 27, 2014 at 14:10
  • what if we want to call another method of SomeClass in action? We cannot access methods and properties of an instance of SomeClass using self. Commented Dec 4, 2021 at 0:55
  • @ddzzbbwwmm: there is no class yet when running the code inside the class body. You can treat it as a local namespace in a function instead, so reference other functions by their name. Commented Jan 19, 2022 at 19:38