Replies: 1 comment 6 replies
-
Hi @GTorreil it's "Computed Field" from pydantic import BaseModel, computed_field
class Rectangle(BaseModel):
width: int
length: int
@computed_field
@property
def area(self) -> int:
return self.width * self.length
print(Rectangle(width=3, length=2).model_dump())
#> {'width': 3, 'length': 2, 'area': 6} |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there,
Congratulations for releasing V1 :)
I'm migrating my app to it, but there's something I don't really understand.
The documentation here says :
What is the pydantic functionnality that replaces it ?
Beta Was this translation helpful? Give feedback.
All reactions