Problems with ABC/Interfaces using pydantic + Mixins pattern
TL;DR: why does this: class Data(BaseModel): a: int class IData(ABC): @abstractproperty def a(self): ... class XData(Data, IData): ... raise: TypeError: Can't instantiate abstract class XData with abstract method a when I instantiate XData likes x = XData(a=1)? I'm trying to implement Mixin pattern while I'm using Pydantics BaseClass to facilitate the instantiation and validation of data from my class. The problem is that my Mixins cannot inherit from my base classes (actually, the dependency is the opposite). Also, I'm using mypy so my implementation needs to be correctly typed. Let's see a s
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.