Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2befd9a

Browse files
committed
Merged revisions 74762 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r74762 | ezio.melotti | 2009-09-13 07:48:45 +0300 (Sun, 13 Sep 2009) | 1 line more list()s on dictviews ........
1 parent b2f9e3b commit 2befd9a

5 files changed

Lines changed: 8 additions & 9 deletions

File tree

Doc/c-api/mapping.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ Mapping Protocol
5151
.. cfunction:: PyObject* PyMapping_Keys(PyObject *o)
5252

5353
On success, return a list of the keys in object *o*. On failure, return *NULL*.
54-
This is equivalent to the Python expression ``o.keys()``.
54+
This is equivalent to the Python expression ``list(o.keys())``.
5555

5656

5757
.. cfunction:: PyObject* PyMapping_Values(PyObject *o)
5858

5959
On success, return a list of the values in object *o*. On failure, return
60-
*NULL*. This is equivalent to the Python expression ``o.values()``.
60+
*NULL*. This is equivalent to the Python expression ``list(o.values())``.
6161

6262

6363
.. cfunction:: PyObject* PyMapping_Items(PyObject *o)
6464

6565
On success, return a list of the items in object *o*, where each item is a tuple
6666
containing a key-value pair. On failure, return *NULL*. This is equivalent to
67-
the Python expression ``o.items()``.
67+
the Python expression ``list(o.items())``.
6868

6969

7070
.. cfunction:: PyObject* PyMapping_GetItemString(PyObject *o, char *key)

Doc/library/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ Example:
669669
'Return a new Point object replacing specified fields with new values'
670670
result = _self._make(map(kwds.pop, ('x', 'y'), _self))
671671
if kwds:
672-
raise ValueError('Got unexpected field names: %r' % kwds.keys())
672+
raise ValueError('Got unexpected field names: %r' % list(kwds.keys()))
673673
return result
674674
<BLANKLINE>
675675
def __getnewargs__(self):

Doc/library/doctest.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,7 @@ is vulnerable! One workaround is to do ::
701701

702702
instead. Another is to do ::
703703

704-
>>> d = foo().items()
705-
>>> d.sort()
704+
>>> d = sorted(foo().items())
706705
>>> d
707706
[('Harry', 'broomstick'), ('Hermione', 'hippogryph')]
708707

Doc/library/modulefinder.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ The script that will output the report of bacon.py::
8484
print('Loaded modules:')
8585
for name, mod in finder.modules.items():
8686
print('%s: ' % name, end='')
87-
print(','.join(mod.globalnames.keys()[:3]))
87+
print(','.join(list(mod.globalnames.keys())[:3]))
8888

8989
print('-'*50)
9090
print('Modules not imported:')

Doc/library/shelve.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ object)::
141141
# such key)
142142
del d[key] # delete data stored at key (raises KeyError
143143
# if no such key)
144-
flag = key in d # true if the key exists
145-
klist = d.keys() # a list of all existing keys (slow!)
144+
flag = key in d # true if the key exists
145+
klist = list(d.keys()) # a list of all existing keys (slow!)
146146

147147
# as d was opened WITHOUT writeback=True, beware:
148148
d['xx'] = range(4) # this works as expected, but...

0 commit comments

Comments
 (0)