You used generics and boom! 💥 'List' is invariant. Consider using 'Sequence' instead.

preview_player
Показать описание
"List" is invariant. Consider using "Sequence" instead, which is covariant ---
You just got this error and perhaps you have already fixed it but still wonder why it happened at all. In this video, you learn to fix the problem and why it happened by learning about variance in programming languages

C H A P T E R S
0:15 Python list is invariant
1:55 Generics
3:50 Subtyping relationship is called variance
5:30 Violating covariance
6:55 Using a Sequence
9:20 Where is variance stored?

M Y O N L I N E T R A I N I N G

#invariant #covariant #contravariant
Рекомендации по теме
Комментарии
Автор

"Let me show you the quickest way to get to the problem...." I love that mindset 😊

josephroiml