What is the purpose of the “self” keyword when defining or calling instance methods?

Advertisement

  • self means that no other arguments are required to be passed into the method.
  • There is no real purpose for the self method; it’s just historic computer science jargon that Python keeps to stay consistent with other programming languages.
  • self refers to the instance whose method was called.
  • self refers to the class that was inherited from to create the object using self.
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