“Python sublinhe variável” Respostas de código

Nome da variável inicial com Python sublinhado

_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
Real Raccoon

Python sublinhe variável

_var    #- Preferred convention for internal variables and methods
var_    #- Used to avoid naming conflicts with Python keywords
__var   #- Used for name mangling by Python when used in class context
        #- Python interpreter changes the name of the variable to avoid 
#collision with child class
__var__ #- Reserved for special use in the language
        #- Used as a temporary or don't care varaibles
patrick204nqh

Respostas semelhantes a “Python sublinhe variável”

Perguntas semelhantes a “Python sublinhe variável”

Mais respostas relacionadas para “Python sublinhe variável” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código