title: Unpacking iterable using map
body: <p>Assuming I have two iterables of numbers of the same length</p>
  
  <pre><code>weights = range(0, 10)
  values = range(0, 100, 10)
  </code></pre>
  
  <p>I need to count weighted sum. I know that it can be done with list comprehension</p>
  
  <pre><code>weighted_sum = sum(weight * value for weight, value in zip(weights, values))
  </code></pre>
  
  <p>I wonder if it can be done using <a href="https://docs.python.org/3/library/functions.html#map" rel="nofollow noreferrer"><code>map</code></a> and <a href="https://docs.python.org/3/library/operator.html#operator.mul" rel="nofollow noreferrer"><code>operator.mul</code></a> like</p>
  
  <pre><code>import operator
  
  weighted_sum = sum(map(operator.mul, zip(weights, values)))
  </code></pre>
  
  <p>but this gives an error</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;input&gt;", line 3, in &lt;module&gt;
  TypeError: op_mul expected 2 arguments, got 1
  </code></pre>
  
  <p>so my question: is there any way of passing unpacked tuples to function using <code>map</code>?</p>