title: Converting binary representation to signed 64 bit integer in Python
body: <p>Against the advice of online resources, I'm using Python to do some simple bit shifting in one of my scripts. The bit shifting is fine, it's representing the result that's difficult. Let me explain.</p>
  
  <p>I have a 64 bit binary representation  </p>
  
  <p><code>1000010101010111010101010101010101010101010101010111010101010101</code>  </p>
  
  <p>which, when represented as a signed integer, should be negative. However, Python defaults to type <code>long</code>, preventing the number from being signed by the first bit, yielding the number <code>9608242155010487637</code>.  </p>
  
  <p>How can I get Python to recognize the sign bit in 64 bits?</p>
  
  <p>To clarify, I'm using Python 2.7.</p>