cthoyt/class-resolver

Add method to lookup class

Closed this issue · 0 comments

mberr commented

Sometimes we want to lookup a class, i.e., not pass-through instances, but map them to their class.

Currently, we can do so with the following work-around:

instance_or_cls = tokenizer_resolver.lookup(instance)
cls = instance_or_cls.__class__ if isinstance(instance_or_cls, BaseClass) else instance_or_cls