Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
whpeeters opened this issue Aug 3, 2023 · 0 comments
Open

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

whpeeters opened this issue Aug 3, 2023 · 0 comments

Comments

@whpeeters
Copy link

whpeeters commented Aug 3, 2023

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant