NEW generic / alias syntax for python 3.12 (PEP 695) (intermediate) anthony explains #561

preview_player
Показать описание
today we go over the new syntax added in python 3.12 for generics and type aliases!

==========

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!
Рекомендации по теме
Комментарии
Автор

Here's to Anthony: The only guy who's not afraid of opening a browser window in front of you *while recording* and typing something that starts with "P".

MostWantedracer
Автор

Well I don't know if I like this new syntax but I know I've always hated the weirdly redundant TypeVar syntax.

unvergebeneid
Автор

this is great, very Rust-like

I think they should use <T> for generics

rexase
Автор

if it is possible, please make a video about variants; thank you.

amirongoogle
Автор

Maybe I've been brainwashed by C++ but I find the new syntax very readable and natural.

BrunoBeltran
Автор

5:08 That's the most logical syntax to me, what would you have preferred?

workflowinmind
Автор

for someone who uses typevars a lot this syntax kinda grew in me tbh…

qexat
Автор

This change does not look very intuitive...
In addition, now the function signatures become so long when we add type hints, how should we cope with the 80-ish characters per line rule of PEP8? (Yes, I think 80-ish is still better even when we have much wider screens these days)

NicolasChanCSY
Автор

Looks a lot like Go generics syntax, thanks for the video!

bradb
Автор

why is it def f[T: (str, bytes)](x:T):... and not def f[T: str | bytes](x:T):...? i tried the version that is more intuitive to me and it works. Is it not guaranteed to work? whats the deal with the whole thing?

iliya-malecki
Автор

At this point, almost all languages are functionally the same with different syntax. everything but maybe rust which can be emulated with robust linter in cpp.

yorailevi
Автор

What is the video talking about covariance ?

RoyAAD
Автор

I like types, yes I do. I like types, how about you?

BenjaminWheeler
Автор

Hi Anthony, nice video as always! would be nice to hear your thoughts on typing.Annotated!

ismailbello
Автор

How do you remember all the syntaxs without any code completion or autosuggesions? 🙄

fuadnafiz
Автор

after watching this video i have only one question: python wtf are you doing?

blanky_nap
Автор

Hurray! Good riddance to "from ___future___ import annotations."

calebparks
Автор

IDK why python implemented generics when its a dynamically typed language. I'm kinda hyped when I first knew this and it is much simpler to implement in 3.12. I play with it a bit and came to a conclusion that it is pretty much useless in python.

MrYevelnad
Автор

No performance gain, just useless syntax stuff that is littering Python.

mailoisback