@@ -1243,23 +1243,11 @@ def __init_subclass__(cls):
12431243
12441244 def __add__ (self , other ):
12451245 """
1246- Composes two transforms together such that *self* is followed
1247- by *other*.
1246+ Compose two transforms together so that *self* is followed by *other*.
12481247 """
1249- if isinstance (other , Transform ):
1250- return composite_transform_factory (self , other )
1251- raise TypeError (
1252- "Can not add Transform to object of type '%s'" % type (other ))
1253-
1254- def __radd__ (self , other ):
1255- """
1256- Composes two transforms together such that *self* is followed
1257- by *other*.
1258- """
1259- if isinstance (other , Transform ):
1260- return composite_transform_factory (other , self )
1261- raise TypeError (
1262- "Can not add Transform to object of type '%s'" % type (other ))
1248+ return (composite_transform_factory (self , other )
1249+ if isinstance (other , Transform ) else
1250+ NotImplemented )
12631251
12641252 # Equality is based on object identity for `Transform`s (so we don't
12651253 # override `__eq__`), but some subclasses, such as TransformWrapper &
@@ -2289,9 +2277,9 @@ def __init__(self, a, b, **kwargs):
22892277 Create a new composite transform that is the result of
22902278 applying transform *a* then transform *b*.
22912279
2292- You will generally not call this constructor directly but use the
2293- `composite_transform_factory` function instead, which can automatically
2294- choose the best kind of composite transform instance to create.
2280+ You will generally not call this constructor directly but write ``a +
2281+ b`` instead, which will automatically choose the best kind of composite
2282+ transform instance to create.
22952283 """
22962284 if a .output_dims != b .input_dims :
22972285 raise ValueError ("The output dimension of 'a' must be equal to "
@@ -2405,13 +2393,11 @@ class CompositeAffine2D(Affine2DBase):
24052393 def __init__ (self , a , b , ** kwargs ):
24062394 """
24072395 Create a new composite transform that is the result of
2408- applying transform *a* then transform *b*.
2409-
2410- Both *a* and *b* must be instances of :class:`Affine2DBase`.
2396+ applying `Affine2DBase` *a* then `Affine2DBase` *b*.
24112397
2412- You will generally not call this constructor directly but use the
2413- `composite_transform_factory` function instead, which can automatically
2414- choose the best kind of composite transform instance to create.
2398+ You will generally not call this constructor directly but write ``a +
2399+ b`` instead, which will automatically choose the best kind of composite
2400+ transform instance to create.
24152401 """
24162402 if not a .is_affine or not b .is_affine :
24172403 raise ValueError ("'a' and 'b' must be affine transforms" )
0 commit comments