“Python unterstreicht die Variable” Code-Antworten

Variablenname mit Unterstrich 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
Real Raccoon

Python unterstreicht die Variable

_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

Ähnliche Antworten wie “Python unterstreicht die Variable”

Fragen ähnlich wie “Python unterstreicht die Variable”

Weitere verwandte Antworten zu “Python unterstreicht die Variable” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen