File tree Expand file tree Collapse file tree 3 files changed +338
-250
lines changed
code/13-protocol-abc/typing Expand file tree Collapse file tree 3 files changed +338
-250
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,6 @@ def __complex__(self):
167167 return complex (self .x , self .y )
168168
169169 @classmethod
170- def fromcomplex (cls , datum ):
171- return cls (datum .real , datum .imag ) # <1>
170+ def fromcomplex (cls , n ):
171+ return cls (n .real , n .imag ) # <1>
172172# end::VECTOR2D_V4_COMPLEX[]
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ def __complex__(self) -> complex: # <2>
168168 return complex (self .x , self .y )
169169
170170 @classmethod
171- def fromcomplex (cls , datum : SupportsComplex ) -> Vector2d : # <3>
172- c = complex (datum ) # <4>
171+ def fromcomplex (cls , n : complex | SupportsComplex ) -> Vector2d : # <3>
172+ c = complex (n ) # <4>
173173 return cls (c .real , c .imag )
174174# end::VECTOR2D_V5_COMPLEX[]
You can’t perform that action at this time.
0 commit comments