]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
finish backporting binary literals and new octal literals docs
authorBenjamin Peterson <benjamin@python.org>
Thu, 30 Oct 2008 22:44:18 +0000 (22:44 +0000)
committerBenjamin Peterson <benjamin@python.org>
Thu, 30 Oct 2008 22:44:18 +0000 (22:44 +0000)
Doc/library/stdtypes.rst
Doc/reference/lexical_analysis.rst

index 737ea9743093d04d2659144ac20a3d46a477f442..f5a4e6c0bdaedaf2e64f0601703d713261818583 100644 (file)
@@ -246,14 +246,15 @@ Complex numbers have a real and imaginary part, which are each implemented using
    pair: octal; literals
 
 Numbers are created by numeric literals or as the result of built-in functions
-and operators.  Unadorned integer literals (including hex and octal numbers)
-yield plain integers unless the value they denote is too large to be represented
-as a plain integer, in which case they yield a long integer.  Integer literals
-with an ``'L'`` or ``'l'`` suffix yield long integers (``'L'`` is preferred
-because ``1l`` looks too much like eleven!).  Numeric literals containing a
-decimal point or an exponent sign yield floating point numbers.  Appending
-``'j'`` or ``'J'`` to a numeric literal yields a complex number with a zero real
-part. A complex numeric literal is the sum of a real and an imaginary part.
+and operators.  Unadorned integer literals (including binary, hex, and octal
+numbers) yield plain integers unless the value they denote is too large to be
+represented as a plain integer, in which case they yield a long integer.
+Integer literals with an ``'L'`` or ``'l'`` suffix yield long integers (``'L'``
+is preferred because ``1l`` looks too much like eleven!).  Numeric literals
+containing a decimal point or an exponent sign yield floating point numbers.
+Appending ``'j'`` or ``'J'`` to a numeric literal yields a complex number with a
+zero real part. A complex numeric literal is the sum of a real and an imaginary
+part.
 
 .. index::
    single: arithmetic
index 03e4c054ccbf5c59c6d9a8d14f3314363eae42a0..f05b91b66b637c18126a01444ed3dd47bee5ab74 100644 (file)
@@ -605,6 +605,7 @@ Numeric literals
    single: long integer literal
    single: floating point literal
    single: hexadecimal literal
+   single: binary literal
    single: octal literal
    single: decimal literal
    single: imaginary literal
@@ -631,11 +632,12 @@ definitions:
    longinteger: `integer` ("l" | "L")
    integer: `decimalinteger` | `octinteger` | `hexinteger` | `bininteger`
    decimalinteger: `nonzerodigit` `digit`* | "0"
-   octinteger: "0" `octdigit`+
+   octinteger: "0" ("o" | "O") `octdigit`+ | "0" `octdigit`+
    hexinteger: "0" ("x" | "X") `hexdigit`+
    bininteger: "0" ("b" | "B") `bindigit`+
    nonzerodigit: "1"..."9"
    octdigit: "0"..."7"
+   bindigit: "0" | "1"
    hexdigit: `digit` | "a"..."f" | "A"..."F"
 
 Although both lower case ``'l'`` and upper case ``'L'`` are allowed as suffix