“Variable de pitón” Código de respuesta

Nombre de la variable de inicio con pitón inferior

_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

Variable de pitón

_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

Respuestas similares a “Variable de pitón”

Preguntas similares a “Variable de pitón”

Más respuestas relacionadas con “Variable de pitón” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código