i have been learning javascript so far but i'm new to python, and i want to do this:
def Node():
def __init__(self):
pass
def callbacks(self):
# i want this to change the value of the Tree property a to 2, how?:w
self.self.a = 2
class Tree():
def __init__(self):
self.a = 1
def printt(self):
b = Node()
b.callbacks()
print(self.a)
a = Tree()
a.printt()
could anyone help or propose a better way to do this or even explain if it's a design pattern ?
Aucun commentaire:
Enregistrer un commentaire