title: subclassing int to attain a Hex representation
body: <p>Basically I want to have access to all standard python int operators, eg <code>__and__</code> and <code>__xor__</code> etc, specifically whenever the result is finally printed I want it represented in Hex format.  (Kind of like putting my calculator into Hex mode)</p>
  
  <pre><code>class Hex(int):
    def __repr__(self):
      return "0x%x"%self
    __str__=__repr__ # this certainly helps with printing
  
  if __name__=="__main__":
    print Hex(0x1abe11ed) ^ Hex(440720179)
    print Hex(Hex(0x1abe11ed) ^ Hex(440720179))
  </code></pre>
  
  <p>Ideally BOTH line of output should be hexadecimal: 0xfacade, however the first one yields decimal: 16435934</p>
  
  <p>Any ideas?</p>