diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-10-27 18:27:48 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-10-27 18:27:48 (GMT) |
commit | 4d85953fe609197c54827826963eabaf6418024c (patch) | |
tree | 4e95540cd87738a3a754566c263200d50ddc54fd /Objects | |
parent | c2f011201ae374da4544b93aba09d0279c139c18 (diff) | |
download | cpython-4d85953fe609197c54827826963eabaf6418024c.zip cpython-4d85953fe609197c54827826963eabaf6418024c.tar.gz cpython-4d85953fe609197c54827826963eabaf6418024c.tar.bz2 |
dictionary() constructor:
+ Change keyword arg name from "x" to "items". People passing a mapping
object can stretch their imaginations <wink>.
+ Simplify the docstring text.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/dictobject.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index f901499..167f901 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1781,7 +1781,7 @@ static int dict_init(PyObject *self, PyObject *args, PyObject *kwds) { PyObject *arg = NULL; - static char *kwlist[] = {"x", 0}; + static char *kwlist[] = {"items", 0}; int result = 0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:dictionary", @@ -1807,12 +1807,10 @@ static char dictionary_doc[] = "dictionary() -> new empty dictionary.\n" "dictionary(mapping) -> new dict initialized from a mapping object's\n" " (key, value) pairs.\n" -"dictionary(seq) -> new dict initialized from the 2-element elements of\n" -" a sequence; for example, from mapping.items(). seq must be an\n" -" iterable object, producing iterable objects each producing exactly\n" -" two objects, the first of which is used as a key and the second as\n" -" its value. If a given key is seen more than once, the dict retains\n" -" the last value associated with it."; +"dictionary(seq) -> new dict initialized as if via:\n" +" d = {}\n" +" for k, v in seq:\n" +" d[k] = v"; PyTypeObject PyDict_Type = { PyObject_HEAD_INIT(&PyType_Type) |