]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport bin() documentation
authorBenjamin Peterson <benjamin@python.org>
Thu, 30 Oct 2008 22:39:25 +0000 (22:39 +0000)
committerBenjamin Peterson <benjamin@python.org>
Thu, 30 Oct 2008 22:39:25 +0000 (22:39 +0000)
Doc/library/functions.rst
Doc/reference/lexical_analysis.rst

index 03525caa87252b054961bcbbac94b8504bbaad13..78d2ad1203f49c9cd906e657283d18b03399894b 100644 (file)
@@ -112,6 +112,15 @@ available.  They are listed here in alphabetical order.
    .. versionadded:: 2.3
 
 
+.. function:: bin(x)
+
+   Convert an integer number to a binary string. The result is a valid Python
+   expression.  If *x* is not a Python :class:`int` object, it has to define an
+   :meth:`__index__` method that returns an integer.
+
+   .. versionadded:: 2.6
+
+
 .. function:: bool([x])
 
    Convert a value to a Boolean, using the standard truth testing procedure.  If
index b54872289bb5a34e1d855d45e0a953e0a99db05b..03e4c054ccbf5c59c6d9a8d14f3314363eae42a0 100644 (file)
@@ -629,10 +629,11 @@ definitions:
 
 .. productionlist::
    longinteger: `integer` ("l" | "L")
-   integer: `decimalinteger` | `octinteger` | `hexinteger`
+   integer: `decimalinteger` | `octinteger` | `hexinteger` | `bininteger`
    decimalinteger: `nonzerodigit` `digit`* | "0"
    octinteger: "0" `octdigit`+
    hexinteger: "0" ("x" | "X") `hexdigit`+
+   bininteger: "0" ("b" | "B") `bindigit`+
    nonzerodigit: "1"..."9"
    octdigit: "0"..."7"
    hexdigit: `digit` | "a"..."f" | "A"..."F"