Is it possible to use a parameter in a class as an identification of the object? For example:
class simpleclass:
def __init__(self, name):
self.name = name
myobject = simpleclass("Jerry")
myobject2 = simpleclass("Jimmy")
how do I call all objects that have the name of "Jerry"? Is it even possible? Thanks!
list_of_objs = [myobject, myobject2]jerrys = [obj for obj in list_of_objs if obj.name == "Jerry"]__init__simplesof simpleclass instances, then `Jerrys = {simple.'Jerry' for simple in simples}. However, simpleclass instances are not callable.selfas the first arg to member methods