Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

what does 64-bit python mean?

3 views
Skip to first unread message

srinivasan srinivas

unread,
Mar 19, 2009, 2:45:19 AM3/19/09
to pytho...@python.org

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

tahnks,
Srini


Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/

Chris Rebert

unread,
Mar 19, 2009, 2:50:01 AM3/19/09
to srinivasan srinivas, pytho...@python.org
On Wed, Mar 18, 2009 at 11:45 PM, srinivasan srinivas
<sri_a...@yahoo.co.in> wrote:
>
> Hi,
> Could someone help me in understanding what 64-bit python means?

It's been compiled for 64-bit processors, so it uses 64-bit pointers
and 64-bit small integers. And I would think it would only work w/ C
extension libraries also compiled for 64-bit CPUs. So, the same
meaning 64-bit has for anything else really.

Cheers,
Chris

--
I have a blog:
http://blog.rebertia.com

Christian Heimes

unread,
Mar 19, 2009, 4:18:25 AM3/19/09
to pytho...@python.org
Chris Rebert wrote:
> It's been compiled for 64-bit processors, so it uses 64-bit pointers
> and 64-bit small integers. And I would think it would only work w/ C
> extension libraries also compiled for 64-bit CPUs. So, the same
> meaning 64-bit has for anything else really.

A 64bit build of Python doesn't necessarily mean that the small integer
type is 64bit, too. Python uses the datatype long on all platforms. On
Windows sizeof(long) == 4 (four bytes) on 32 and 64 versions of Windows.

Christian

"Martin v. Löwis"

unread,
Mar 19, 2009, 4:30:52 AM3/19/09
to
> 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

0 new messages