diff options
author | Raymond Hettinger <python@rcn.com> | 2003-12-17 20:43:33 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-12-17 20:43:33 (GMT) |
commit | 64958a15d7c03efdc3d2eddf247666e18d1fd910 (patch) | |
tree | bc135ae082f8635fa858b81f52f141d7ffbd4c78 /Objects | |
parent | df38ea9c29a431602704c6bd45ca7417225a61c4 (diff) | |
download | cpython-64958a15d7c03efdc3d2eddf247666e18d1fd910.zip cpython-64958a15d7c03efdc3d2eddf247666e18d1fd910.tar.gz cpython-64958a15d7c03efdc3d2eddf247666e18d1fd910.tar.bz2 |
Guido grants a Christmas wish:
sorted() becomes a regular function instead of a classmethod.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/listobject.c | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 3915cc9..47673be 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2021,38 +2021,6 @@ PyList_Sort(PyObject *v) } static PyObject * -listsorted(PyObject *cls, PyObject *args, PyObject *kwds) -{ - PyObject *newlist, *v, *seq, *compare=NULL, *keyfunc=NULL, *newargs; - static char *kwlist[] = {"iterable", "cmp", "key", "reverse", 0}; - long reverse; - - if (args != NULL) { - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOi:sorted", - kwlist, &seq, &compare, &keyfunc, &reverse)) - return NULL; - } - - newlist = PyObject_CallFunctionObjArgs(cls, seq, NULL); - if (newlist == NULL) - return NULL; - - newargs = PyTuple_GetSlice(args, 1, 4); - if (newargs == NULL) { - Py_DECREF(newlist); - return NULL; - } - v = listsort((PyListObject *)newlist, newargs, kwds); - Py_DECREF(newargs); - if (v == NULL) { - Py_DECREF(newlist); - return NULL; - } - Py_DECREF(v); - return newlist; -} - -static PyObject * listreverse(PyListObject *self) { if (self->ob_size > 1) @@ -2394,9 +2362,6 @@ PyDoc_STRVAR(reverse_doc, PyDoc_STRVAR(sort_doc, "L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;\n\ cmp(x, y) -> -1, 0, 1"); -PyDoc_STRVAR(sorted_doc, -"list.sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list;\n\ -cmp(x, y) -> -1, 0, 1"); static PyObject *list_subscript(PyListObject*, PyObject*); @@ -2412,8 +2377,6 @@ static PyMethodDef list_methods[] = { {"count", (PyCFunction)listcount, METH_O, count_doc}, {"reverse", (PyCFunction)listreverse, METH_NOARGS, reverse_doc}, {"sort", (PyCFunction)listsort, METH_VARARGS | METH_KEYWORDS, sort_doc}, - {"sorted", (PyCFunction)listsorted, - METH_VARARGS | METH_KEYWORDS | METH_CLASS, sorted_doc}, {NULL, NULL} /* sentinel */ }; |