title: Is there a 'foreach' function in Python 3?
body: <p>When I meet the situation I can do it in javascript, I always think if there's an <code>foreach</code> function it would be convenience. By foreach I mean the function which is described below:</p>
  
  <pre><code>def foreach(fn,iterable):
      for x in iterable:
          fn(x)
  </code></pre>
  
  <p>they just do it on every element and didn't yield or return something,i think it should be a built-in function and should be more faster than writing it with pure Python, but I didn't found it on the list,or it just called another name?or I just miss some points here?</p>
  
  <p>Maybe I got wrong, cause calling an function in Python cost high, definitely not a good practice for the example. Rather than an out loop, the function should do the loop in side its body looks like this below which already mentioned in many python's code suggestions:</p>
  
  <pre><code>def fn(*args):
      for x in args:
         dosomething
  </code></pre>
  
  <p>but I thought foreach is still welcome base on the two facts:</p>
  
  <ol>
  <li>In normal cases, people just don't care about the performance</li>
  <li>Sometime the API didn't accept iterable object and you can't rewrite its source.</li>
  </ol>