When trying to execute an expression like obj1 * obj2 for custom objects, Python internally calls _______.

  • __mul__
  • __mult__
  • __multiply__
  • __product__
When you attempt to execute an expression like obj1 * obj2 for custom objects, Python internally calls the __mul__ method. Implementing this method allows you to define how the multiplication operation behaves for your objects.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *