@@ -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 &
@@ -2285,9 +2273,9 @@ def __init__(self, a, b, **kwargs):
22852273 Create a new composite transform that is the result of
22862274 applying transform *a* then transform *b*.
22872275
2288- You will generally not call this constructor directly but use the
2289- `composite_transform_factory` function instead, which can automatically
2290- choose the best kind of composite transform instance to create.
2276+ You will generally not call this constructor directly but write ``a +
2277+ b`` instead, which will automatically choose the best kind of composite
2278+ transform instance to create.
22912279 """
22922280 if a .output_dims != b .input_dims :
22932281 raise ValueError ("The output dimension of 'a' must be equal to "
@@ -2401,13 +2389,11 @@ class CompositeAffine2D(Affine2DBase):
24012389 def __init__ (self , a , b , ** kwargs ):
24022390 """
24032391 Create a new composite transform that is the result of
2404- applying transform *a* then transform *b*.
2405-
2406- Both *a* and *b* must be instances of :class:`Affine2DBase`.
2392+ applying `Affine2DBase` *a* then `Affine2DBase` *b*.
24072393
2408- You will generally not call this constructor directly but use the
2409- `composite_transform_factory` function instead, which can automatically
2410- choose the best kind of composite transform instance to create.
2394+ You will generally not call this constructor directly but write ``a +
2395+ b`` instead, which will automatically choose the best kind of composite
2396+ transform instance to create.
24112397 """
24122398 if not a .is_affine or not b .is_affine :
24132399 raise ValueError ("'a' and 'b' must be affine transforms" )
0 commit comments