Problem: I need a special Method in Python that is executed AFTER the Object is created.
Suppose i have a situation:
##-User Class;
class User:
__objList = [] ## User Class register of userObjs;
__init__(self, name):
self.name = name
##-and i create new UserObj;
user = User("John Doe")
How can i add this UserObj in User.__objList[] after creation of Object user?
Is there a method in Python that executes after the object is initialized?
PS.I need add this usrObj in User.__objList after userObj was created by class automatically.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…