The difference in Python OOP between:

  • instance method
  • class method
  • static method

visually explained using ๐—บ๐—ฒ๐—บ๐—ผ๐—ฟ๐˜†_๐—ด๐—ฟ๐—ฎ๐—ฝ๐—ต:

you are viewing a single comment's thread
view the rest of the comments
[โ€“] 1 point 4 months ago (2 children)

My personal convention in C++ was to use an m prefix on member variables and a g for class variables.

I guess in Python, I think of _ as equivalent to protected scope in C++ and __ (double underscore) as equivalent to private. Not a perfect analogy, but it works for me.

  • source
  • parent
  • hideshow 2 child comments