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
19ab2bd1
Commit
19ab2bd1
authored
Sep 10, 2007
by
Collin Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove yet more references to has_key() methods.
parent
6fe2a6c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
7 deletions
+6
-7
Doc/c-api/abstract.rst
Doc/c-api/abstract.rst
+2
-2
Doc/reference/datamodel.rst
Doc/reference/datamodel.rst
+3
-3
Doc/tutorial/datastructures.rst
Doc/tutorial/datastructures.rst
+1
-2
No files found.
Doc/c-api/abstract.rst
View file @
19ab2bd1
...
...
@@ -824,14 +824,14 @@ Mapping Protocol
.. cfunction:: int PyMapping_HasKeyString(PyObject *o, char *key)
On success, return ``1`` if the mapping object has the key *key* and ``0``
otherwise. This is equivalent to the Python expression ``
o.has_key(key)
``.
otherwise. This is equivalent to the Python expression ``
key in o
``.
This function always succeeds.
.. cfunction:: int PyMapping_HasKey(PyObject *o, PyObject *key)
Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. This
is equivalent to the Python expression ``
o.has_key(key)
``. This function always
is equivalent to the Python expression ``
key in o
``. This function always
succeeds.
...
...
Doc/reference/datamodel.rst
View file @
19ab2bd1
...
...
@@ -1602,7 +1602,7 @@ either to emulate a sequence or to emulate a mapping; the difference is that for
a sequence, the allowable keys should be the integers *k* for which ``0 <= k <
N`` where *N* is the length of the sequence, or slice objects, which define a
range of items. It is also recommended that mappings provide the methods
:meth:`keys`, :meth:`values`, :meth:`items`, :meth:`
has_key`, :meth:`
get`,
:meth:`keys`, :meth:`values`, :meth:`items`, :meth:`get`,
:meth:`clear`, :meth:`setdefault`,
:meth:`pop`, :meth:`popitem`, :meth:`copy`, and
:meth:`update` behaving similar to those for Python's standard dictionary
...
...
@@ -1618,8 +1618,8 @@ repetition) by defining the methods :meth:`__add__`, :meth:`__radd__`,
described below; they should not define other numerical operators. It is
recommended that both mappings and sequences implement the :meth:`__contains__`
method to allow efficient use of the ``in`` operator; for mappings, ``in``
should
be equivalent of :meth:`has_key`; for sequences, it should search throug
h
the values. It is further recommended that both mappings and sequences
should
search the mapping's keys; for sequences, it should searc
h
th
rough th
e values. It is further recommended that both mappings and sequences
implement the :meth:`__iter__` method to allow efficient iteration through the
container; for mappings, :meth:`__iter__` should be the same as
:meth:`keys`; for sequences, it should iterate through the values.
...
...
Doc/tutorial/datastructures.rst
View file @
19ab2bd1
...
...
@@ -385,8 +385,7 @@ using a non-existent key.
The :meth:`keys` method of a dictionary object returns a list of all the keys
used in the dictionary, in arbitrary order (if you want it sorted, just apply
the :meth:`sort` method to the list of keys). To check whether a single key is
in the dictionary, either use the dictionary's :meth:`has_key` method or the
:keyword:`in` keyword.
in the dictionary, use the :keyword:`in` keyword.
Here is a small example using a dictionary::
...
...
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