backport bin() documentation

This commit is contained in:
Benjamin Peterson 2008-10-30 22:39:25 +00:00
parent ab5f879022
commit b5f8208b49
2 changed files with 11 additions and 1 deletions

View 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

View 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"