[Python-checkins] r74762 - in python/branches/py3k/Doc: c-api/mapping.rst library/collections.rst library/doctest.rst library/modulefinder.rst library/shelve.rst
ezio.melotti
python-checkins at python.org
Sun Sep 13 06:48:45 CEST 2009
Author: ezio.melotti
Date: Sun Sep 13 06:48:45 2009
New Revision: 74762
Log:
more list()s on dictviews
Modified:
python/branches/py3k/Doc/c-api/mapping.rst
python/branches/py3k/Doc/library/collections.rst
python/branches/py3k/Doc/library/doctest.rst
python/branches/py3k/Doc/library/modulefinder.rst
python/branches/py3k/Doc/library/shelve.rst
Modified: python/branches/py3k/Doc/c-api/mapping.rst
==============================================================================
--- python/branches/py3k/Doc/c-api/mapping.rst (original)
+++ python/branches/py3k/Doc/c-api/mapping.rst Sun Sep 13 06:48:45 2009
@@ -51,20 +51,20 @@
.. 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)
Modified: python/branches/py3k/Doc/library/collections.rst
==============================================================================
--- python/branches/py3k/Doc/library/collections.rst (original)
+++ python/branches/py3k/Doc/library/collections.rst Sun Sep 13 06:48:45 2009
@@ -669,7 +669,7 @@
'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):
Modified: python/branches/py3k/Doc/library/doctest.rst
==============================================================================
--- python/branches/py3k/Doc/library/doctest.rst (original)
+++ python/branches/py3k/Doc/library/doctest.rst Sun Sep 13 06:48:45 2009
@@ -701,8 +701,7 @@
instead. Another is to do ::
- >>> d = foo().items()
- >>> d.sort()
+ >>> d = sorted(foo().items())
>>> d
[('Harry', 'broomstick'), ('Hermione', 'hippogryph')]
Modified: python/branches/py3k/Doc/library/modulefinder.rst
==============================================================================
--- python/branches/py3k/Doc/library/modulefinder.rst (original)
+++ python/branches/py3k/Doc/library/modulefinder.rst Sun Sep 13 06:48:45 2009
@@ -84,7 +84,7 @@
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:')
Modified: python/branches/py3k/Doc/library/shelve.rst
==============================================================================
--- python/branches/py3k/Doc/library/shelve.rst (original)
+++ python/branches/py3k/Doc/library/shelve.rst Sun Sep 13 06:48:45 2009
@@ -141,8 +141,8 @@
# 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...
More information about the Python-checkins
mailing list