attrs vs Pydantic #5121
Replies: 2 comments
-
|
There are few cool things coming in pydantic v2, look at this https://pydantic-docs.helpmanual.io/blog/pydantic-v2/ |
Beta Was this translation helpful? Give feedback.
-
|
I agree with @dmsfabiano that attrs yields better performance, and can be far more customized than Pydantic, due to its class-decorator. Class decorators enable major performance benefits when initializing custom features, where instance based functionality like PyDantic must be re-performed every init. One way to enable multiple styles of class without a significant burden in development would be for FASTAPI to develop its own I dont really know enough about FASTAPI's class use to establish what should happen in this decorator besides selecting functionality based on the base class. This also allows for expansion of functionality beyond current class definitions |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all!
Very broad question, I am a big fan of both attrs and pydantic. Recently, I have been definitely more into attrs, knowing the fact that attrs yields to better performance I am curious on why it pydantic was chosen over attrs (or even dataclasses) and if there are plans to include compatibility for it?
Beta Was this translation helpful? Give feedback.
All reactions