def __init__(self, name, elements, attributes): self.name = name flattened = flatten(elements) self.elements = list( element for element in flattened if not isinstance(element, dict) ) self.attributes = attributes for element in flattened: if isinstance(element, dict): self.attributes.update(element)
def __init__(self, name, elements, attributes): self.name = name self.elements = flatten(elements) self.attributes = attributes