What is the purpose of the self keyword when defining or calling methods on an instance of an object?

Advertisement

  • self refers to the class that was inherited from to create the object using self.
  • There is no real purpose for the self method. It’s just legacy computer science jargon that Python keeps to stay consistent with other programming languages.
  • self means that no other arguments are required to be passed into the method.
  • self refers to the instance whose method was called.
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment


Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend