how to declare type for defaultdict(defaultdict) #8839
-
Hi I just updated pyright to 1.1.377 and I get now type errors for The code to reproduce what I mean would be:
I get error:
How to do the fyi. I've also asked this on stackoverflow |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
On first inspection, this looks like a bug. I'll create an issue from the discussion. In the meantime, you can work around the issue this way: d: DefaultDict[int, DefaultDict[int, MyClass]] = defaultdict(defaultdict[int, MyClass]) This workaround might not work on older versions of Python where |
Beta Was this translation helpful? Give feedback.
On first inspection, this looks like a bug. I'll create an issue from the discussion. In the meantime, you can work around the issue this way:
This workaround might not work on older versions of Python where
defaultdict
was not indexable.