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

hy-repr probably shouldn't use the registered function of a supertype #1873

Closed
Kodiologist opened this issue Feb 17, 2020 · 0 comments · Fixed by #2059
Closed

hy-repr probably shouldn't use the registered function of a supertype #1873

Kodiologist opened this issue Feb 17, 2020 · 0 comments · Fixed by #2059

Comments

@Kodiologist
Copy link
Member

If you make a new class C that inherits from a class B with a registered hy-repr function f-B, but don't register a function for C, then hy-repr on an instance of C will call f-B, which can be misleading: it looks like you have an instance of B when actually you have an instance of C. We should probably fall back on repr instead.

For example, pandas's Timestamp class inherits from datetime, so hy-repr on a timestamp will give you the impression that you have a plain datetime.

Removing this feature will mean that hy-repr on a namedtuple will no longer just work, but that's probably an okay trade-off.

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

Successfully merging a pull request may close this issue.

1 participant