class myClass():
@staticmethod
def all_object():
pass
myInstances = []
def __init__(self, myStr01, myStr02):
self.myStr01 = myStr01
self.myStr02 = myStr02
self.__class__.myInstances.append(self)
myObj01 = myClass("Foo", "Bar")
myObj02 = myClass("FooBar", "Baz")
Basically I want to make a static method that return a list when calling myClass.all_object() that store myObj01 and myObj02 into a list like [myObj01,myObj02]. And when more object is created it keeps append onto that list.
I don't really know how to actually access the name of the object since it is not stored in the __dict__() method within the class.