I don't think the problem has anything to do with the part you're looking at, but rather with the Connection_XML
class:
class Connection_XML(XML_Element_Class):
### members
name = None
type = None
ID = None
max_size = None
queue_size = None
direction = None
def do_something(self):
pass
All of those members are class attributes. There's a single name
shared by every Connection_XML
instance, a single type
, etc. So, even if your instances are all unique objects, changing one changes all of them.
You want instance attributes—a separate name
, etc., for each instance. The way you do that is to just create the attributes dynamically, usually in the __init__
method:
class Connection_XML(XML_Element_Class):
def __init__(self):
self.name = None
self.type = None
self.ID = None
self.max_size = None
self.queue_size = None
self.direction = None
def do_something(self):
pass
It's hard to be sure this is your problem without a real SSCCE. In this toy example, all of the attributes have the value None
, which is immutable, so it won't really lead to these kinds of problems. But if one of them is, say, a list, or an object that has its own attributes, it will.