come aggiungere codice a una funzione esistente, prima o dopo?Python aggiunge dinamicamente a una funzione
per esempio, ho una classe:
class A(object):
def test(self):
print "here"
Come si modifica la metaprogrammazione classe di ingegno in modo che faccio questo
class A(object):
def test(self):
print "here"
print "and here"
forse un modo di aggiungendo un'altra funzione per testare?
aggiungere un'altra funzione come
def test2(self):
print "and here"
e modificare l'originale per
class A(object):
def test(self):
print "here"
self.test2()
c'è un modo per fare questo?
grazie, questo è quello che mi serviva – Timmy