diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 521e3fe603a2..42b35acdc3e7 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -118,17 +118,18 @@ def add(self, key, a): # All the error checking may be unnecessary; but this method # is called so seldom that the overhead is negligible. if not isinstance(a, Axes): - raise ValueError("second argument, %s, is not an Axes" % a) + raise ValueError("second argument, {!r}, is not an Axes".format(a)) try: hash(key) except TypeError: - raise ValueError("first argument, %s, is not a valid key" % key) + raise ValueError( + "first argument, {!r}, is not a valid key".format(key)) a_existing = self.get(key) if a_existing is not None: Stack.remove(self, (key, a_existing)) warnings.warn( - "key %s already existed; Axes is being replaced" % key) + "key {!r} already existed; Axes is being replaced".format(key)) # I don't think the above should ever happen. if a in self: diff --git a/lib/matplotlib/transforms.py b/lib/matplotlib/transforms.py index e2171df3ffcd..000bb38befd1 100644 --- a/lib/matplotlib/transforms.py +++ b/lib/matplotlib/transforms.py @@ -1156,11 +1156,9 @@ def __radd__(self, other): raise TypeError( "Can not add Transform to object of type '%s'" % type(other)) - def __eq__(self, other): - # equality is based on transform object id. Hence: - # Transform() != Transform(). - # Some classes, such as TransformWrapper & AffineBase, will override. - return self is other + # Equality is based on object identity for `Transform`s (so we don't + # override `__eq__`), but some subclasses, such as TransformWrapper & + # AffineBase, override this behavior. def _iter_break_from_left_to_right(self): """