-
I'm a bit confused about invariance in relation to lists. I get why this produces an error, types should match exactly: e: list[int] = [3, 4]
f: list[int | None] = e # Error At the same time this doesn't produce an error: f: list[int | None] = [3, 4] * 2 I guess strictly speaking Then why this again produces an error? f: list[int | None] = [3, 4] * 2 * 2 |
Beta Was this translation helpful? Give feedback.
Answered by
erictraut
Aug 22, 2022
Replies: 1 comment 5 replies
-
You may find this documentation useful. In particular, take a look at the section on bidirectional type inference. |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
Molkree
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You may find this documentation useful. In particular, take a look at the section on bidirectional type inference.