diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2009-09-13 04:48:45 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2009-09-13 04:48:45 (GMT) |
commit | 8f7649eae4194c3ed5407714300a1da1daf8bee0 (patch) | |
tree | 8c37d96adae2e33a8ed09d2dc885e93089a462b7 /Doc | |
parent | 6aa7c8ce3ce0ef942956ee4cf3563082d53f0d75 (diff) | |
download | cpython-8f7649eae4194c3ed5407714300a1da1daf8bee0.zip cpython-8f7649eae4194c3ed5407714300a1da1daf8bee0.tar.gz cpython-8f7649eae4194c3ed5407714300a1da1daf8bee0.tar.bz2 |
more list()s on dictviews
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/mapping.rst | 6 | ||||
-rw-r--r-- | Doc/library/collections.rst | 2 | ||||
-rw-r--r-- | Doc/library/doctest.rst | 3 | ||||
-rw-r--r-- | Doc/library/modulefinder.rst | 2 | ||||
-rw-r--r-- | Doc/library/shelve.rst | 4 |
5 files changed, 8 insertions, 9 deletions
diff --git a/Doc/c-api/mapping.rst b/Doc/c-api/mapping.rst index 1d0ed50..5b2de14 100644 --- a/Doc/c-api/mapping.rst +++ b/Doc/c-api/mapping.rst @@ -51,20 +51,20 @@ Mapping Protocol .. cfunction:: PyObject* PyMapping_Keys(PyObject *o) On success, return a list of the keys in object *o*. On failure, return *NULL*. - This is equivalent to the Python expression ``o.keys()``. + This is equivalent to the Python expression ``list(o.keys())``. .. cfunction:: PyObject* PyMapping_Values(PyObject *o) On success, return a list of the values in object *o*. On failure, return - *NULL*. This is equivalent to the Python expression ``o.values()``. + *NULL*. This is equivalent to the Python expression ``list(o.values())``. .. cfunction:: PyObject* PyMapping_Items(PyObject *o) On success, return a list of the items in object *o*, where each item is a tuple containing a key-value pair. On failure, return *NULL*. This is equivalent to - the Python expression ``o.items()``. + the Python expression ``list(o.items())``. .. cfunction:: PyObject* PyMapping_GetItemString(PyObject *o, char *key) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index d7907b0..cd38956 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -669,7 +669,7 @@ Example: 'Return a new Point object replacing specified fields with new values' result = _self._make(map(kwds.pop, ('x', 'y'), _self)) if kwds: - raise ValueError('Got unexpected field names: %r' % kwds.keys()) + raise ValueError('Got unexpected field names: %r' % list(kwds.keys())) return result <BLANKLINE> def __getnewargs__(self): diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst index 2d0f48a..2aa3ae1 100644 --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -701,8 +701,7 @@ is vulnerable! One workaround is to do :: instead. Another is to do :: - >>> d = foo().items() - >>> d.sort() + >>> d = sorted(foo().items()) >>> d [('Harry', 'broomstick'), ('Hermione', 'hippogryph')] diff --git a/Doc/library/modulefinder.rst b/Doc/library/modulefinder.rst index 6db02ff..41b387b 100644 --- a/Doc/library/modulefinder.rst +++ b/Doc/library/modulefinder.rst @@ -84,7 +84,7 @@ The script that will output the report of bacon.py:: print('Loaded modules:') for name, mod in finder.modules.items(): print('%s: ' % name, end='') - print(','.join(mod.globalnames.keys()[:3])) + print(','.join(list(mod.globalnames.keys())[:3])) print('-'*50) print('Modules not imported:') diff --git a/Doc/library/shelve.rst b/Doc/library/shelve.rst index aa402c4..65303e9 100644 --- a/Doc/library/shelve.rst +++ b/Doc/library/shelve.rst @@ -141,8 +141,8 @@ object):: # such key) del d[key] # delete data stored at key (raises KeyError # if no such key) - flag = key in d # true if the key exists - klist = d.keys() # a list of all existing keys (slow!) + flag = key in d # true if the key exists + klist = list(d.keys()) # a list of all existing keys (slow!) # as d was opened WITHOUT writeback=True, beware: d['xx'] = range(4) # this works as expected, but... |