title: Convert variable-sized byte array to a integer/long
body: <p>How can I convert a (big endian) variable-sized binary byte array to an (unsigned) integer/long? As an example, <code>'\x11\x34'</code>, which represents 4404</p>
  
  <p>Right now, I'm using </p>
  
  <pre><code>def bytes_to_int(bytes):
    return int(bytes.encode('hex'), 16)
  </code></pre>
  
  <p>Which is small and somewhat readable, but probably not very efficient. Is there a better (more obvious) way?</p>