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

types.is_type not detecting subtyping? #167

Open
eulerreich opened this issue Oct 23, 2015 · 1 comment
Open

types.is_type not detecting subtyping? #167

eulerreich opened this issue Oct 23, 2015 · 1 comment

Comments

@eulerreich
Copy link

types.is_type(OrderedMap(), Map) returns false, so it seems that the behavior of is_type is to check literally if the object is of the specified type, rather than whether it's derived from the type (which is the behavior of isinstance in python).

If this is the intended behavior, perhaps there should be some words on this in the doc for is_type.

@stevedonovan
Copy link
Contributor

Good point! We could change the implementation, but it would only work for Lua class systems where _base always points to the derived type; if m = OrderedMap(), then both OrderedMap:class_of(m) and Map:class_of(m) are true. One approach is to try to resolve the 'class' method class_of.

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

No branches or pull requests

2 participants