GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing docs.python.org — 2.4.4 Integer and long integer literals

Previous Page Up One Level Next Page Python Reference Manual Contents Index
Previous: 2.4.3 Numeric literals Up: 2.4 Literals Next: 2.4.5 Floating point literals


2.4.4 Integer and long integer literals

Integer and long integer literals are described by the following lexical definitions:

longinteger:    integer ("l"|"L")
integer:        decimalinteger | octinteger | hexinteger
decimalinteger: nonzerodigit digit* | "0"
octinteger:     "0" octdigit+
hexinteger:     "0" ("x"|"X") hexdigit+
nonzerodigit:   "1"..."9"
octdigit:       "0"..."7"
hexdigit:        digit|"a"..."f"|"A"..."F"

Although both lower case `l' and upper case `L' are allowed as suffix for long integers, it is strongly recommended to always use `L', since the letter `l' looks too much like the digit `1'.

Plain integer decimal literals must be at most 2147483647 (i.e., the largest positive integer, using 32-bit arithmetic). Plain octal and hexadecimal literals may be as large as 4294967295, but values larger than 2147483647 are converted to a negative value by subtracting 4294967296. There is no limit for long integer literals apart from what can be stored in available memory.

Some examples of plain and long integer literals:

7     2147483647                        0177    0x80000000
3L    79228162514264337593543950336L    0377L   0x100000000L


Previous Page Up One Level Next Page Python Reference Manual Contents Index
Previous: 2.4.3 Numeric literals Up: 2.4 Literals Next: 2.4.5 Floating point literals

See About this document... for information on suggesting changes.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.