diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-10-30 22:39:25 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-10-30 22:39:25 +0000 |
commit | b5f8208b49bbe399efaf7b246b47acf6e5dc8487 (patch) | |
tree | 71ebeb235c41335af6cd8db0c3f7d6fc54030f68 | |
parent | ab5f87902299fb92a2dbae356c853158881cd980 (diff) | |
download | cpython-git-b5f8208b49bbe399efaf7b246b47acf6e5dc8487.tar.gz |
backport bin() documentation
-rw-r--r-- | Doc/library/functions.rst | 9 | ||||
-rw-r--r-- | Doc/reference/lexical_analysis.rst | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 03525caa87..78d2ad1203 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -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 diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst index b54872289b..03e4c054cc 100644 --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -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" |