Commit b5f8208b authored by Benjamin Peterson's avatar Benjamin Peterson

backport bin() documentation

parent ab5f8790
......@@ -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
......
......@@ -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"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment