Skip to content

Overriding add() requires overriding append() as well #94

@whpeeters

Description

@whpeeters

When overriding the .add() method in a subclass, I think the desired behavior of obj.append() would be to call the .add() method of the subclass, right? However, the append method is currently "implemented" as append = add in OrderedSet, which does not lead to a call of .add() in the subclass.

Would the following implementation of the .append() method in OrderedSet maybe resolve the issue?

def append(self, key: T) -> int:
    return self.add(key)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions