You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deprecate unusual ways of creating empty TypedDicts #105570
Of these four options, only T3 and T4 are supported by type checkers. typing.TypedDict has been around for a while now, so if T1 and T2 are still unsupported by type checkers, they probably never will be supported.
Deprecating, and eventually removing, the first two ways of constructing empty TypedDicts will allow us to simplify the code at runtime. It will also be less confusing for users. Every way in which the runtime and type checkers differ in behaviour is a potential point of confusion for users; in general, we should work to keep these points of difference to a minimum.
I also don't think these methods of constructing empty TypedDicts are particularly common.
Previous discussion
For very similar reasons, we previously deprecated and removed the keyword-argument syntax for creating TypedDicts. This was deprecated in 3.11, and removed in 3.13:
Activity
sobolevn commentedon Jun 10, 2023
I think that we should keep
T4, because this way people might:class EmptyDict(TypedDict): ..., which is a valid use-caseOthers are good candidates to be deprecated, I agree.
AlexWaygood commentedon Jun 10, 2023
Yes, I agree. I'm proposing we deprecate T1 and T2, but keep T3 and T4. I've edited my original post to clarify that point :)
pythongh-105570: Deprecate unusual ways of creating empty TypedDicts
gh-105570: Deprecate unusual ways of creating empty TypedDicts (#105780)