what does the double underscore __ mean in python? -


this question has answer here:

what double underscore indicate in python? remember reading tutorial said had hidden variable, feel there more , keep seeing examples of code have double underscores , don't understand means.

from pep 8:

  • __double_leading_underscore: when naming class attribute, invokes name mangling (inside class foobar, __boo becomes _foobar__boo; see below).

  • __double_leading_and_trailing_underscore__: "magic" objects or attributes live in user-controlled namespaces. e.g. __init__, __import__ or __file__. never invent such names; use them documented.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -