Chapter 2. Lexical analysis 14 The Python Language Reference, Release 3.9.5 (continued from previous page) ... >>> foo.__doc__ is None True See also PEP 498 for the proposal that added formatted string literals, and str.format() , which uses a related format string mechanism. There are three types of numeric literals: integers, floating point numbers, and imaginary numbers. There are no complex literals (complex numbers can be formed by adding a real number and an imaginary number). Note that numeric literals do not include a sign; a phrase like -1 is actually an expression composed of the unary operator ‘$_{-}$ ‘ and the literal$_{1}$ . Integer literals are described by the following lexical definitions: There is no limit for the length of integer literals apart from what can be stored in available memory. Underscores are ignored for determining the numeric value of the literal. They can be used to group digits for enhanced readability. One underscore can occur between digits, and after base specifiers like$_{0x}$ . Note that leading zeros in a non-zero decimal number are not allowed. This is for disambiguation with C-style octal literals, which Python used before version 3.0. Some examples of integer literals: Changed in version 3.6: Underscores are now allowed for grouping purposes in literals. 7 2147483647 0o177 0b100110111 3 79228162514264337593543950336 0o377 0xdeadbeef 100_000_000_000 0b_1110_0101 2.4.4 Numeric literals 2.4.5 Integer literals integer ::= decinteger | bininteger | octinteger | hexinteger decinteger ::= nonzerodigit (["_"] digit bininteger ::= "0" ("b" | "B") (["_"] bindigit )+ octinteger ::= "0" ("o" | "O") (["_"] octdigit )+ hexinteger ::= "0" ("x" | "X") (["_"] hexdigit )+ nonzerodigit ::= "1"..."9" digit ::= "0"..."9" bindigit ::= "0" | "1" octdigit ::= "0"..."7" hexdigit ::= digit | "a"..."f" | "A"..."F"