Replies: 1 comment
-
|
Guh. Abstract base class horror shows, huh? Please, Gods... Let this not be the Multiple Inheritance Diamond Problem! 😱 Actually, I can't replicate this. I feel great relief, whereas you now feel great trepidation. Given this minimal-working example, we clearly see that @beartype still correctly type-checks ABCs: from abc import ABC
from beartype.door import die_if_unbearable
class Foo(ABC): ...
class Bar(Foo): ...
x = Bar()
die_if_unbearable(x, Foo)
print("I'm OK! You're OK! @Moosems isn't OK! But that's gotta be OK!")...which prints: In other words, In your elongated example, I note that your Well done, by the way. Every type hierarchy needs a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey @leycec its me again, here to steal your week once more 🙂
I am trying to do some funky class stuff in a project but am getting a beartype issue on the latest version. Heres a very simplified example of what I'm doing:
Foo is a skeleton class meant to force good API usage and Bar is a subclass doing said API usage. When I run this in my actual project with the actual classes I get this:
Ok, thats a lot of stuff that has no relevance and probably confuses you, so I'll stick to what's important:
This can be translated easily over to my example:
So what it's trying to scream at me is that I can't use Foo for my catch all type handling. I could just remove my types here and it work but that feels like cheating. Any thoughts?
If it matters, here's the actual values in the project that gave the issue:
Beta Was this translation helpful? Give feedback.
All reactions