Skip to content

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

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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