Sep-30-2021, 08:21 PM
I think you are asking if there is a way to automatically call a method ONLY for the first instance of a class. There is no such thing, but it is something you could write using a a class method to keep track
If I am totally off base on my interpretation, write the python code to do what you want to do. Even if it doesn't work it is a good way to describe what you are thinking.
class Alpha(): first = True def __init__(self): if self.__class__.first: print("I am first", self) self.__class__.first = False else: # Do not first stuff print("I am not", self) [Alpha() for _ in range(3)].
If I am totally off base on my interpretation, write the python code to do what you want to do. Even if it doesn't work it is a good way to describe what you are thinking.