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
Mypy disallows del td[key] for typed dicts. However, it should be okay to delete a key from typed dict if the key exists and it's not a required key. del with a non-literal key should always be rejected.
The text was updated successfully, but these errors were encountered:
This adds support for these methods through additional plugin hooks:
* `pop`
* `setdefault`
* `update` (positional argument only)
* `__delitem__`
These methods also work and don't need plugin support:
* `copy`
* `has_key` (Python 2 only)
* `viewitems` (Python 2 only)
* `viewkeys` (Python 2 only)
* `viewvalues` (Python 2 only)
The base signatures for all of these methods are defined in
`mypy_extensions._TypedDict`, which is a stub-only class
only used internally by mypy. It becomes the new fallback
type of all TypedDicts.
Fixes#3843. Fixes#3550.
There's some possible follow-up work that I'm leaving to other PRs,
such as optimizing hook lookup through dictionaries in the default
plugin, documenting the supported methods, and `update` with
keyword arguments (#6019).
Mypy disallows
del td[key]
for typed dicts. However, it should be okay to delete a key from typed dict if the key exists and it's not a required key.del
with a non-literal key should always be rejected.The text was updated successfully, but these errors were encountered: