title: Python: Checking to which bin a value belongs
body: <p>I have a list of values and a list of bin edges. Now I need to check for all values to what bin they belong to. Is there a more pythonic way than iterating over the values and then over the bins and checking if the value belongs to the current bin, like:</p>
  
  <pre><code>my_list = [3,2,56,4,32,4,7,88,4,3,4]
  bins = [0,20,40,60,80,100]
  
  for i in my_list:
      for j in range(len(bins)):
          if bins(j) &lt; i &lt; bins(j+1):
              DO SOMETHING
  </code></pre>
  
  <p>This doesn't look very pretty to me.
  Thanks!</p>