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
fromtypingimport*deff(arg: Sequence[Dict[Union[int,str], str]]) ->None:
...
defq(arg: Sequence[Union[int,str]]) ->None:
...
q([1,2,3,'a']) # This worksf([{'a':'a'}]) # This worksl= [{'a':'a'}]
f(l) # This does not
It seems that assigning the same value to a variable or passing it directly gets typed differently for some reason.
The text was updated successfully, but these errors were encountered:
The type of the same thing is being inferred differently depending if it's assigned to a variable or passed as a parameter. That is what I'm reporting here.
That's also expected behavior. If you assign it to a variable, the type of the variable is fixed at the definition site, but if you use a literal as an argument to a function mypy uses type context to infer a different type.
This possibly relates to this #6463
It seems that assigning the same value to a variable or passing it directly gets typed differently for some reason.
The text was updated successfully, but these errors were encountered: