title: How to create a fixed size (unsigned) integer in python?
body: <p>I want to create a fixed size integer in python, for example 4 bytes. Coming from a C background, I expected that all the primitive types will occupy a constant space in memory, however when I try the following in python:  </p>
  
  <pre><code>import sys  
  print sys.getsizeof(1000)
  print sys.getsizeof(100000000000000000000000000000000000000000000000000000000)
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>&gt;&gt;&gt;24  
  &gt;&gt;&gt;52
  </code></pre>
  
  <p>respectively.<br>
  How can I create a fixed size (unsigned) integer of 4 bytes in python? I need it to be 4 bytes regardless if the binary representation uses 3 or 23 bits, since later on I will have to do byte level memory manipulation with Assembly. </p>