MLC102: Scene.play argument cannot be converted to an Animation¶
qual reports MLC102 when a positional argument of a confirmed
Scene.play call is known not to be convertible into an animation:
- the result of a fluent mobject mutator (
mob.shift(...)mutates immediately and returns the mobject itself — the classic bug), - a freshly constructed bare mobject (
play(Square())), - a name known to hold a bare mobject,
- a numeric or string literal.
Scene.play compiles its arguments (DESIGN §3.2): Animation instances pass
through, .animate builders become animations, and everything else raises
TypeError at render time.
- Default severity:
error - Minimum confidence:
high - Implementation phase:
1 - Fix: rewriting
mob.method(args)tomob.animate.method(args)is offered as an UNSAFE suggestion for single fluent calls
.animate chains, arguments resolving to Animation classes, and unknown
values never fire.
Wrong¶
class Demo(Scene):
def construct(self):
square = Square()
self.play(square.shift(RIGHT))
self.play(square)