Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8f7649ea
Commit
8f7649ea
authored
Sep 13, 2009
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more list()s on dictviews
parent
6aa7c8ce
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
9 deletions
+8
-9
Doc/c-api/mapping.rst
Doc/c-api/mapping.rst
+3
-3
Doc/library/collections.rst
Doc/library/collections.rst
+1
-1
Doc/library/doctest.rst
Doc/library/doctest.rst
+1
-2
Doc/library/modulefinder.rst
Doc/library/modulefinder.rst
+1
-1
Doc/library/shelve.rst
Doc/library/shelve.rst
+2
-2
No files found.
Doc/c-api/mapping.rst
View file @
8f7649ea
...
...
@@ -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)
...
...
Doc/library/collections.rst
View file @
8f7649ea
...
...
@@ -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):
...
...
Doc/library/doctest.rst
View file @
8f7649ea
...
...
@@ -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
')]
...
...
Doc/library/modulefinder.rst
View file @
8f7649ea
...
...
@@ -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
:
')
...
...
Doc/library/shelve.rst
View file @
8f7649ea
...
...
@@ -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...
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment