How does Python evaluate the following expression? anim1 gets executed after anim2. How does a simple + operator that?
anim1 = Animation(duration=1, center=(100,100) type='delta')
anim2 = Animation(duration=1, rotation=45 type='delta')
anim = anim1 + anim2
This will call anim1.__add__(anim2).
In order to understand what is happening under the hood you have to inspect the definition of __add__ method from Animation class.
In Python, you can redefine the behavior of the mathematical operators. If I understood your question, Animation probably redefines the "+" operator using the __add__ method.
More info: Official Documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With