O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required