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
Let me know if I need to scope this better. Even if this gets closed, it's also fine - if you have a better scope / new information it may be worth making a new, improved issue.
I agree that this should work, but I don't think there's anything actionable here for typeshed to do. Both TypedDict and NamedTuple need to be heavily special-cased by type checkers and I don't see any way for typeshed to help with that.
The good news is that at least with mypy 1.11.2 the tuple case seems to work.
Originally posted here
Let me know if I need to scope this better. Even if this gets closed, it's also fine - if you have a better scope / new information it may be worth making a new, improved issue.
I want to downstream users to export a typed
tuple
anddict
from myDetails
dataclass,dataclasses.astuple
anddataclasses.asdict
Output:
Why would a user want to reuse dict/tuple/etc?
To maintain mypy
strict = True
complianceThey have an open source library and want tuples / dicts to be available for downstream use.
In practice, I wanted my
dataclasses
in libvcs (here) to be able to let the enduser get typeddict
/tuple
'sSpreading into functions
*params
,**params
, e.g. loading dataReuse in
args
/kwargs
of function declarations, e.g.Problem
TypedDict
,NamedTuple
) with the same shape / types as adataclass
don't workRelated
#8518,
python/mypy#4128
The text was updated successfully, but these errors were encountered: