I would like to create a unique ID for each object I created - here's the class:
class resource_cl :
def __init__(self, Name, Position, Type, Active):
self.Name = Name
self.Position = Position
self.Type = Type
self.Active = Active
I would like to have a self.ID that auto increments everytime I create a new reference to the class, such as:
resources = []
resources.append(resource_cl('Sam Sneed', 'Programmer', 'full time', True))
I know I can reference resource_cl, but I'm not sure how to proceed from there...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…