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
For example, dict is a subclass of MutableMapping and hence also Mapping and other classes, and almost all of dict's methods are actually provided by one of those superclasses with the same signature. Is there a good reason to repeat the declarations of these methods in dict? (Perhaps they predate dict's superclasses?) I tried removing get and there seemed to be no ill effects.
One possible reason: it's convenient to see the types of all of dict's methods in one place. But it also creates more work when changing these types, as in #223. For being able to see all the methods of dict at once, we could have mypy automatically generate documentation (or perhaps a python documentation tool already understands function annotations).
The text was updated successfully, but these errors were encountered:
I think it's mostly a historical accident. I would generally discourage people from reading the stubs as a form of documentation, they're really not meant for that.
momandine
pushed a commit
to momandine/typeshed
that referenced
this issue
Jul 5, 2016
For example,
dict
is a subclass ofMutableMapping
and hence alsoMapping
and other classes, and almost all ofdict
's methods are actually provided by one of those superclasses with the same signature. Is there a good reason to repeat the declarations of these methods indict
? (Perhaps they predatedict
's superclasses?) I tried removingget
and there seemed to be no ill effects.One possible reason: it's convenient to see the types of all of
dict
's methods in one place. But it also creates more work when changing these types, as in #223. For being able to see all the methods ofdict
at once, we could have mypy automatically generate documentation (or perhaps a python documentation tool already understands function annotations).The text was updated successfully, but these errors were encountered: