Skip to content

Instantly share code, notes, and snippets.

@shichao-an
Created May 1, 2014 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shichao-an/b447d24f0a5381b0fa92 to your computer and use it in GitHub Desktop.
Save shichao-an/b447d24f0a5381b0fa92 to your computer and use it in GitHub Desktop.
Get integer bits of current CPython implementation
import sys
def get_int_bits():
if hasattr(sys, 'maxsize'):
max_int = getattr(sys, 'maxsize')
else:
max_int = getattr(sys, 'maxint')
if max_int >> 62 == 0:
return 32
else:
return 64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment