python typing: Optional is not optional! (intermediate) anthony explains #146

preview_player
Показать описание
today I talk about the Optional type in python typing and why I think it is very poorly named

==========

I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you'd like to see please comment below!
Рекомендации по теме
Комментарии
Автор

"from typing import Optional as Noneable" 😁

mmoussa
Автор

exactly the explanation i needed. thank you!

ng
Автор

I like when you keep the stream cam setup

WaylonWalker
Автор

Optional is really a type that means we have a box and inside the box maybe there is some(value) or none(value). Its a great tool if enforced and completely eliminates the runtime nil/null reference at “compile” time. If incorporated into the language correctly

brianfontenot
Автор

I'm one of those people confused by this naming, and your video helped quite a bit in explaining stuff. However, I still don't understand why you can't set an optional function argument to Optional[int], since it seems like Optional means the type could be either Int or None. In your function y is an int when set by default, so why is it not valid to do this?

Strider
Автор

that new | syntax has already landed in 3.10 apparently

sadhlife
Автор

In NixOS types, this is called "NullOr", maybe more clear.

MatthewPherigo
Автор

thank you . I was sos confused with this keyword

srkbhayo
Автор

30:32 I'm sure there's plenty of other thing that you would want to change as well. 😅

goodclover
Автор

Even Option[int] would be way better I don't get it...

nexovec
Автор

Trying to replicate maybe monad I guess.

shivanshmishra
Автор

OrNone might have been more intuitive. but now we can just use the easier | None syntax.. although lots of work environments are stuck on older python versions so pain ensues

MElixirDNB