]> granicus.if.org Git - python/commitdiff
#2700 Document PyNumber_ToBase
authorBenjamin Peterson <benjamin@python.org>
Sun, 27 Apr 2008 18:14:39 +0000 (18:14 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sun, 27 Apr 2008 18:14:39 +0000 (18:14 +0000)
Doc/c-api/number.rst

index a79e406665f71094105aa8508e8941a90ce73ebd..3602287b7f666d157a6ddfdbf6640f383c749d2f 100644 (file)
@@ -290,6 +290,17 @@ Number Protocol
    .. versionadded:: 2.5
 
 
+.. cfunction:: PyObject* PyNumber_ToBase(PyObject *n, int base)
+
+   Returns the the integer *n* converted to *base* as a string with a base
+   marker of ``'0b'``, ``'0o'``, or ``'0x'`` if appended applicable.  When
+   *base* is not 2, 8, 10, or 16, the format is ``'x#num'`` where x is the
+   base. If *n* is not an int object, it is converted with
+   :cfunc:`PyNumber_Index` first.
+
+   .. versionadded:: 2.6
+
+
 .. cfunction:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc)
 
    Returns *o* converted to a Py_ssize_t value if *o* can be interpreted as an