title: efficiently checking that string consists of one character in Python
body: <p>What is an efficient way to check that a string <code>s</code> in Python consists of just one character, say <code>'A'</code>? Something like <code>all_equal(s, 'A')</code> which would behave like this:</p>
  
  <pre><code>all_equal("AAAAA", "A") = True
  
  all_equal("AAAAAAAAAAA", "A") = True
  
  all_equal("AAAAAfAAAAA", "A") = False
  </code></pre>
  
  <p>Two seemingly inefficient ways would be to: first convert the string to a list and check each element, or second to use a regular expression. Are there more efficient ways or are these the best one can do in Python?  Thanks.</p>