what does 64-bit python mean?

  • Thread starter srinivasan srinivas
  • Start date
M

Martin v. Löwis

Could someone help me in understanding what 64-bit python means?

While Chris' answer is correct, it doesn't show the consequences
of using a 64-bit Python. Primarily, these are:
- strings, Unicode objects, lists, dicts, and tuples can have more than
2**31 elements.
- you can load 64-bit DLLs into the Python process, and 64-bit
applications (such as a 64-bit Apache or IIS process) can load
the Python interpreter into their address spaces.
- you need a 64-bit operating system to run Python

The first item is only relevant if
a) you have that much data that you want to put into a single
container, and
b) you have that much memory to keep the entire container in
memory. For a list with 2**31 elements, you need 16GiB of
memory to represent the list alone, not counting the actual
data (e.g. for a list of 2**31 Nones). For a dict, you need
more than 48GiB for the dict alone. For a byte string,
2GiB are enough to get past the 2**31 elements boundary.

I just noticed that this description is not completely correct:
in a 32-bit process, the upper size of collections is actually
smaller than 2**31. For a list, you can have only up to 2**30
elements in the list; on many operating systems, only 2**29.
For a dict, the maximum number of elements is even smaller,
around 250 millions. So you would need a 64-bit Python already
to get past these boundaries.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top