Skip to content

RcParams is fundamentally broken #12576

Closed
@timhoffm

Description

@timhoffm

Bug report

Anyone tried:

>>> import matplotlib
>>> len(matplotlib.rcParams)
0

A great example of shooting yourself in the foot with multiple inheritance. Essentially, we do

class RcParams(MutableMapping, dict):
    def __getitem__(self, key):
        return dict.__getitem__(self, key)

    def __setitem__(self, key, val):
        return dict.__setitem__(self, key, val)

but do not reimplement __len__. You can work out the consequences yourself.

Proposed solution

Do not inherit RcParams from dict, and use a private data dict instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions