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
  • 19
    No difference other than method_two() definition is invalid and its call fails. Commented Jul 22, 2012 at 13:00
  • 18
    @techtonik: Nothing is wrong with the definition of the method_two! It's being called in an incorrect/invalid spec, i.e. with an extra argument. Commented Sep 10, 2013 at 8:36
  • 2
    Yours are both instance methods, not class methods. You create a class method by applying @classmethod to the definition. The first parameter should be called cls instead of self and will receive the class object rather than an instance of your class: Test.method_three() and a_test.method_three() are equivalent. Commented Aug 4, 2016 at 14:50
  • Why would you want to create a function definition without the self argument? Is there a strong use case for this? Commented Jan 11, 2018 at 14:49