Skip to content

merge nodes with duplicated properties #45

@vgrcs

Description

@vgrcs

Hi,

Does it make sense to implement the "merge" method in the Node class based on the union of properties instead of concatenation of lists? This is the implementation that suits my problem:

def merge(self, other: 'Node'):
"""Merge the contents of a node into this node.
Used by Node.merge_trees()
"""
if not self.label and other.label:
self.label = other.label
#self.properties += other.properties
self.properties = [value for value in self.properties if value not in other.properties]
#self.directives += other.directives
self.directives = [value for value in self.directives if value not in other.directives]
self.children += other.children

Best regards,
Vitor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions