Exploring the use of tag unions in Pydantic for performance optimization by specifying a member of a model for discrimination in validation, allowing for skipping unnecessary validation and improving efficiency, demonstrated with examples.
You're using Pydantic and it seems pretty straightforward, right? But could you adopt some simple changes to your code that would make it a lot faster and more efficient? Chances are, you'll find a couple of the tips from Sydney Runkle that will do just that. Join us to talk about Pydantic performance tips here on Talk Python.
Episode sponsors
Sentry Error Monitoring, Code TALKPYTHON
Code Comments
Talk Python Courses
Links from the show