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
fromtypingimportNamedTupleclassA(NamedTuple):
classB: ... # E: Invalid statement in NamedTuple definition; expected "field_name: field_type [= default]"reveal_type(A.B) # E: "type[A]" has no attribute "B"# N: Revealed type is "Any"
I think that this is a bug that needs to be solved, because we don't have any reason not to allow this (my existing patch shows that semanal and typechecker are happy with allowing these classes).
Python allows
class
definitions insideNamedTuple
bodies:But,
mypy
does not allow this:I think that this is a bug that needs to be solved, because we don't have any reason not to allow this (my existing patch shows that semanal and typechecker are happy with allowing these classes).
This is the root cause of #15752
The text was updated successfully, but these errors were encountered: