Python - Use Less Dictionaries w/ Pydantic & FastAPI

preview_player
Показать описание
I go over what I've been using to replace dictionaries recently.

00:00 Intro
0:23 Pydantic Method
3:43 Pydantic Method Benefits
5:15 Dictionary Method
6:10 Pydantic Dict to Model & Vice Versa
7:42 Pydantic Simple Validations
9:39 FastAPI with Pydantic - Install and Run
10:21 FastAPI with Pydantic - POST Example
12:27 FastAPI with Pydantic - Validations and HTTPExceptions

Links:
Рекомендации по теме
Комментарии
Автор

Pydantic is specifically for parsing data. If your data is already parsed (as far as I know, that's the case with a FastAPI model), there is no reason to use Pydantic. In fact, it will cause a significant slowdown for your code, because (again), Pydantic is made for parsing data, which may be dirty or in the wrong format. If you just use it as an interface for static typing, use the built-in dataclass instead.

SkyyySi
Автор

Simply and insightful video, appreciate it.

aykutcanerdemir
Автор

Thank you for the info. I wish the voice volume was a bit louder.

swiftsword
Автор

That'd be "use fewer dictionaries" or "use dictionaries less (often/frequently)". ;)

Flexximilian
Автор

i use pydantic for i/o models and dataasses for internal models

tommclean
Автор

Thank you. Can you help and do a video that will search the items using query parameter?

abdulnuhu
Автор

why the hell you make another window directed to your arms? dont get it

mariusz
Автор

Nice hands on explanation thanks.
I’m curious how to get vim autocomplete working like yours ?

voidreamer
Автор

funny you thing we should look at your keyboard

aharongina
Автор

Why is this guy dying while making videos? Does he make videos while sleepwalking?

evax
Автор

Nice video! But please, stop using the arrows when using vim ;-)

txemaotero