Replies: 1 comment
-
|
The type of an object is established at the time it is constructed. The expression If you want to avoid this, use an unambiguous context for bidirectional type inference or use an explicit type in a constructor call, like this: pure_list: list[Popen[str]] | list[Popen[bytes]] = list[Popen[str]]() |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I currently work with Popen objects and find a certain pyright behavior confusing, and would even call it a bug. In one of the examples below I get pure
list[Popen[str]]orlist[Popen[bytes]]types when I expect a union of some sort. Why is this the case?Downstream working with elements of these objects is quite buggy.
Code sample in pyright playground
Beta Was this translation helpful? Give feedback.
All reactions