comparison Python/bltinmodule.c @ 47462:d57aa752a401

Remove meaning of -ttt, but still accept -t option on cmdline for compatibility.
author Georg Brandl <georg@python.org>
date Wed, 04 Jun 2008 11:41:32 +0000
parents 23ab586c427a
children d0f783ba7669
comparison
equal deleted inserted replaced
47461:21beb0d5e329 47462:d57aa752a401
262 262
263 PyDoc_STRVAR(any_doc, 263 PyDoc_STRVAR(any_doc,
264 "any(iterable) -> bool\n\ 264 "any(iterable) -> bool\n\
265 \n\ 265 \n\
266 Return True if bool(x) is True for any x in the iterable."); 266 Return True if bool(x) is True for any x in the iterable.");
267
268 static PyObject *
269 builtin_ascii(PyObject *self, PyObject *v)
270 {
271 PyObject *repr, *bytes, *ascii;
272 repr = PyObject_Repr(v);
273 if (!repr)
274 return NULL;
275
276 bytes = PyUnicode_EncodeASCII(
277 PyUnicode_AS_UNICODE(repr),
278 PyUnicode_GET_SIZE(repr),
279 "backslashreplace");
280
281 Py_DECREF(repr);
282 if (bytes == NULL)
283 return NULL;
284
285 ascii = PyUnicode_FromEncodedObject(bytes,
286 "ASCII", NULL);
287 Py_DECREF(bytes);
288 if (ascii == NULL)
289 return NULL;
290
291 return ascii;
292 }
293
294 PyDoc_STRVAR(ascii_doc,
295 "ascii(object) -> string\n\
296 \n\
297 Return the canonical string representation of the object as repr(),\n\
298 but non-ASCII characters in the string are hex-escaped");
267 299
268 300
269 static PyObject * 301 static PyObject *
270 builtin_bin(PyObject *self, PyObject *v) 302 builtin_bin(PyObject *self, PyObject *v)
271 { 303 {
2186 METH_VARARGS | METH_KEYWORDS, build_class_doc}, 2218 METH_VARARGS | METH_KEYWORDS, build_class_doc},
2187 {"__import__", (PyCFunction)builtin___import__, METH_VARARGS | METH_KEYWORDS, import_doc}, 2219 {"__import__", (PyCFunction)builtin___import__, METH_VARARGS | METH_KEYWORDS, import_doc},
2188 {"abs", builtin_abs, METH_O, abs_doc}, 2220 {"abs", builtin_abs, METH_O, abs_doc},
2189 {"all", builtin_all, METH_O, all_doc}, 2221 {"all", builtin_all, METH_O, all_doc},
2190 {"any", builtin_any, METH_O, any_doc}, 2222 {"any", builtin_any, METH_O, any_doc},
2223 {"ascii", builtin_ascii, METH_O, ascii_doc},
2191 {"bin", builtin_bin, METH_O, bin_doc}, 2224 {"bin", builtin_bin, METH_O, bin_doc},
2192 {"chr", builtin_chr, METH_VARARGS, chr_doc}, 2225 {"chr", builtin_chr, METH_VARARGS, chr_doc},
2193 {"cmp", builtin_cmp, METH_VARARGS, cmp_doc}, 2226 {"cmp", builtin_cmp, METH_VARARGS, cmp_doc},
2194 {"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc}, 2227 {"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc},
2195 {"delattr", builtin_delattr, METH_VARARGS, delattr_doc}, 2228 {"delattr", builtin_delattr, METH_VARARGS, delattr_doc},