Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

starting variable name with underscore python

_bar
#No effect, just hint for the user:
#“Hey, this isn’t really meant to be a part of the public interface 
#of this class.
#Best to leave it alone.”
__bar
#protects the variable from getting overridden in subclasses
__bar__
#It’s best to stay away from using names that start and 
#end with double underscores (“dunders”) in your own programs 
#to avoid collisions with future changes to the Python language.
#reserved for magic methods
 
PREVIOUS NEXT
Tagged: #starting #variable #underscore #python
ADD COMMENT
Topic
Name
3+7 =