Skip to content

Many redundant methods in subclasses #229

Closed
@rwbarton

Description

@rwbarton

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions