You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This isn't awful for simple cases here, but I have a case where I need to define hundreds of different specializations of kind (while allowing users to define their own) - hence the need for the generic str at the Person base class, and I'd rather not object to have Field(..., repr=False) in every single spot. Similarly, pydantic doesn't seem to catch that inheritance of incompatible values happens:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I would want something like this
To be able to automatically inherit the annotations on the base
Person
class however the above givesIf instead, I define as
then I get
This isn't awful for simple cases here, but I have a case where I need to define hundreds of different specializations of
kind
(while allowing users to define their own) - hence the need for the genericstr
at thePerson
base class, and I'd rather not object to haveField(..., repr=False)
in every single spot. Similarly, pydantic doesn't seem to catch that inheritance of incompatible values happens:with
where I'd have expected that the creation of the class here would have failed given that
int
is not a subtype ofstr
.Beta Was this translation helpful? Give feedback.
All reactions