Home > Uncategorized > Python’s self

Python’s self

Python methods (functions that are part of a class) have a special explicit parameter called self. Through self, methods can access class members (without a self parameter, the method is static (no access to instance variables)).

In most C languages, the “self” parameter is hidden (an implicit parameter), and is usually accessible through a reserved word (e.g this is C++ and C#).

Which is better? Python’s upfront approach is nice for beginners, but for experienced programmers, it creates some extra work.

Categories: Uncategorized Tags:
  1. No comments yet.
  1. No trackbacks yet.