Last active
May 24, 2016 13:37
-
-
Save bniebuhr/8678d67384d09df5b30f627a701f14fa to your computer and use it in GitHub Desktop.
how do I change Instance inernal variables, so that they ma be used by the class internal functions?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Classe(): | |
def __init__(self): | |
Classe.var1 = 10 | |
Classe.var2 = 3 | |
def printClasse(self): | |
print 'multiply = ' + str(Classe.var1*Classe.var2) | |
class_instance = Classe() | |
class_instance.printClasse() # shows 30, ok | |
class_instance.var1 = 20 | |
class_instance.printClasse() # shows 30, not 60! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment