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.

4
  • In Python comments start with # Commented Feb 13, 2022 at 15:18
  • 1
    It's called name mangling. See docs. Commented Feb 13, 2022 at 15:23
  • Some more info here too: pep8 Commented Feb 13, 2022 at 15:24
  • "Why my_num.getNum() returns 77?" What do you think it should return instead? Why? "Since __num is a private property, how is it accessible through self whereas self points to an object?" I don't understand the objection. Properties belong to objects. getNum is a method of the class, so of course it can directly access attributes by their actual name. Commented Feb 13, 2022 at 15:29