Literals

There are five built-in numeric types:

  • Booleans

  • Integers

  • Long integers

  • Floating-point numbers

  • Complex numbers

The identifiers True and False are interpreted as Boolean values with the integer values of 0 and 1, respectively. A number such as 1234 is interpreted as a decimal integer. To specify an octal or hexadecimal integer, precede the value with 0 or 0x, respectively (for example, 0644 or 0x100fea8). Long integers are typically written with a trailing l (ell) or L character, as in 1234567890L. Unlike integers, which are limited by machine precision, long integers can be of any length (up to the maximum memory of the machine). Although the trailing L is used to denote long integers, it may be omitted. In this case, a large integer value ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.