diff options
| author | Georg Brandl <georg@python.org> | 2008-06-11 18:55:38 (GMT) |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2008-06-11 18:55:38 (GMT) |
| commit | 89f48876a25d753f2888f8ec4a5dba7c0ef90bf2 (patch) | |
| tree | 5564e361641c2dd52cffbc8d2ac3f5b0c515e05f /Modules/future_builtins.c | |
| parent | 35b90202462b27a783e39762a7ec77ad9f2d7ff8 (diff) | |
| download | cpython-89f48876a25d753f2888f8ec4a5dba7c0ef90bf2.zip cpython-89f48876a25d753f2888f8ec4a5dba7c0ef90bf2.tar.gz cpython-89f48876a25d753f2888f8ec4a5dba7c0ef90bf2.tar.bz2 | |
Add future_builtins.ascii().
Diffstat (limited to 'Modules/future_builtins.c')
| -rw-r--r-- | Modules/future_builtins.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/future_builtins.c b/Modules/future_builtins.c index 5baaa60..4c840fb 100644 --- a/Modules/future_builtins.c +++ b/Modules/future_builtins.c @@ -45,11 +45,25 @@ PyDoc_STRVAR(oct_doc, Return the octal representation of an integer or long integer."); +static PyObject * +builtin_ascii(PyObject *self, PyObject *v) +{ + return PyObject_Repr(v); +} + +PyDoc_STRVAR(ascii_doc, +"ascii(object) -> string\n\ +\n\ +Return the same as repr(). In Python 3.x, the repr() result will\n\ +contain printable characters unescaped, while the ascii() result\n\ +will have such characters backslash-escaped."); + /* List of functions exported by this module */ static PyMethodDef module_functions[] = { {"hex", builtin_hex, METH_O, hex_doc}, {"oct", builtin_oct, METH_O, oct_doc}, + {"ascii", builtin_ascii, METH_O, ascii_doc}, {NULL, NULL} /* Sentinel */ }; |
