MLC122: ApplyMethod receives a call result, not the bound method¶
qual reports MLC122 when the first positional argument of
ApplyMethod(...) is the result of calling a fluent mobject method, as in
ApplyMethod(mob.shift(RIGHT)).
ApplyMethod(method, *args) expects an uncalled bound mobject method; it
invokes the method itself during interpolation. Passing the call result
mutates the mobject before the play starts and fails at animation build
time, because the returned mobject is not the callable ApplyMethod
requires.
- Default severity:
error - Minimum confidence:
high - Implementation phase:
1 - Fix: splitting into
ApplyMethod(mob.method, args...)is offered as an UNSAFE suggestion for simple calls
The inner call must conclusively resolve to a curated returns_self
mobject method; unknown callees stay silent.
Wrong¶
class Demo(Scene):
def construct(self):
square = Square()
self.play(ApplyMethod(square.shift(RIGHT)))