title: Python sum of ASCII values of all characters in a string
body: <p>I am searching a more efficient way to sum-up the <a href="http://en.wikipedia.org/wiki/ASCII" rel="noreferrer">ASCII</a> values of all characters in a given string, using only standard python (2.7 is preferable).</p>
  
  <p>Currently I have:</p>
  
  <pre><code>print sum(ord(ch) for ch in text)
  </code></pre>
  
  <p><strong>I want to emphasize that my main focus and aspect of this question is what I wrote above.</strong></p>
  
  <p><strong>The following is somewhat less important aspect of this question and should be treated as such</strong>:</p>
  
  <p>So why I am asking it?! I have compared this approach vs embedding a simple C-code function which does the same <a href="http://markandclick.com/advance.html#Cboost" rel="noreferrer">here</a> using PyInline, and it seems that a simple C embedded function is 17 times faster.</p>
  
  <p>If there is no Python approach faster than what I have suggested (using only standard Python), it seems strange that the Python developers haven't added such an implementation in the core.</p>
  
  <p>Current results for suggested answers.
  On my Windows 7, i-7, Python 2.7:</p>
  
  <pre><code> text = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
   sum(ord(ch) for ch in text)
   &gt;&gt; 0.00521324663262
   sum(array.array("B", text))
   &gt;&gt; 0.0010040770317
   sum(map(ord, text ))
   &gt;&gt; 0.00427160369234
   sum(bytearray(text))
   &gt;&gt; 0.000864669402933
  
   C-code embedded:
   &gt;&gt; 0.000272828426841
  </code></pre>