Source
manim/mobject/graphing/coordinate_systems.py, line 159 (as of HEAD ):
def coords_to_point(self, *coords: ManimFloat) -> Point3D:
# TODO: I think the method should be able to return more than just a single point.
# E.g. see the implementation of it on line 2065.
raise NotImplementedError()
(Note: the "line 2065" reference in the original TODO is stale. The concrete implementations of coords_to_point live in subclasses such as Axes and NumberPlane, see def coords_to_point matches in the same file.)
Problem
The abstract coords_to_point declares a return type of Point3D (a single point), but the concrete implementations in subclasses return multiple points when given multiple input coordinates. The base class signature is inconsistent with the actual behaviour of its subclasses.
This affects:
- Type checkers, which will accept code that breaks at runtime.
- Users reading the API, who cannot infer that batch input is supported.
- Future implementers of the abstract base, who may write a single-point-only override that is incompatible with how callers use the method.
Suggested approaches
- Change the return type annotation in the base class to reflect the batch behaviour, e.g.
Point3D | list[Point3D] or Point3D | npt.NDArray.
- Audit all subclass implementations to confirm they handle both single-coord and multi-coord input consistently.
- Update
point_to_coords similarly if it has the same gap.
Source
manim/mobject/graphing/coordinate_systems.py, line 159 (as of HEAD ):(Note: the "line 2065" reference in the original TODO is stale. The concrete implementations of
coords_to_pointlive in subclasses such asAxesandNumberPlane, seedef coords_to_pointmatches in the same file.)Problem
The abstract
coords_to_pointdeclares a return type ofPoint3D(a single point), but the concrete implementations in subclasses return multiple points when given multiple input coordinates. The base class signature is inconsistent with the actual behaviour of its subclasses.This affects:
Suggested approaches
Point3D | list[Point3D]orPoint3D | npt.NDArray.point_to_coordssimilarly if it has the same gap.