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
We could possibly change ParamSpec.kwargs objects so that their upper bound is Mapping[str, object] rather than dict[str, object]. However, note that prior to #12668, previously we received complaints that people couldn't mutate ParamSpec kwargs: #12386. I don't know that there's a foolproof way of catching all unsafe code here without emitting false positives on "safe" transformations of ParamSpec.kwargs objects.
Yeah that makes sense -- the ::pop use-case is pretty idiomatic.
It would be nice if an operation like kwargs["ka"] were able to return something with Concatenate[..., P], but that seems tricky as well: we'd have to return a new object rather than mutate in-place (plus, I'm not sure it's even possible to Concatenate a kwarg...?).
In any case, I think I can work around this on my end. Thanks for the response!
Bug Report
Even though it fails at runtime,
mypy
doesn't complain if I mutateParamSpec.kwargs
.To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=f5cea6637a9ea13c48b8ba75aa8d73dd
If I run this same code in an interpreter, I get
Expected Behavior
I would expect this to trigger an error on line 12.
The text was updated successfully, but these errors were encountered: