On Jun 2, 9:30 pm, jay <[EMAIL PROTECTED]> wrote:
> I was reading in a book that the 'int' type can store whole numbers
> up to 32 bits.  I'm not exactly sure what that means, but got me
> wondering, what's the largest number you can store as an 'int' before
> you need to switch over to 'long'?

sys.maxint.  This is 2,147,483,647 on a 32-bit machine, or
9,223,372,036,854,775,807 on a 64-bit machine.  In general, an N-bit
signed integer can store numbers between -2**(N-1) and 2**(N-1)-1,
inclusive.

Note that recent versions of Python automatically promote the results
of integer arithmetic to long if necessary, so the distinction is less
relevant than it used to be.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to