PCJ #
class PCJ (Object):
# class property records to see if executed initialization method
init_flag = False
DEF __init __ (Self):
# If the class attribute is true, direct return
IF Pcj.init_flag:
return
# otherwise perform the initial shipment method
print ( "performs initialization method")
# after execution, modify the value True
Pcj.init_flag = True
P1 = PCJ ()
P2 = PCJ ()
Initialization actions execute only once
Guess you like
Origin www.cnblogs.com/pcjbk/p/11295222.html
Recommended
Ranking