Pardon my low-tech question, but either I'm going insane, or this simply doesn't exist.
I get that you can do 5 * 5
and that will work, basic Python.
You can even do operator.mul(5, 5)
. But why is there no helper function for multiplication over a iterable
?
I'm surprised to find that mul()
isn't a standard built-in, or at the very least being a reference to it in either of the two main docs you end up in searching for mathematical functions. But also that there's no helper function called times(iterable)
(or similar) that takes a iterable as an argument, much like sum()
. It would for instance be handy when calculating the area size of a image if the image size is given as a tuple/list.
- https://docs.python.org/3/library/functions.html
- https://docs.python.org/3/library/math.html
- How can I multiply all items in a list together with Python?
Am I blind or is there a reason for this? Isn't multiplication used that much?