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

Skip to content

Commit 19ab2bd

Browse files
committed
Remove yet more references to has_key() methods.
1 parent 6fe2a6c commit 19ab2bd

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

Doc/c-api/abstract.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,14 +824,14 @@ Mapping Protocol
824824
.. cfunction:: int PyMapping_HasKeyString(PyObject *o, char *key)
825825

826826
On success, return ``1`` if the mapping object has the key *key* and ``0``
827-
otherwise. This is equivalent to the Python expression ``o.has_key(key)``.
827+
otherwise. This is equivalent to the Python expression ``key in o``.
828828
This function always succeeds.
829829

830830

831831
.. cfunction:: int PyMapping_HasKey(PyObject *o, PyObject *key)
832832

833833
Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. This
834-
is equivalent to the Python expression ``o.has_key(key)``. This function always
834+
is equivalent to the Python expression ``key in o``. This function always
835835
succeeds.
836836

837837

Doc/reference/datamodel.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,7 @@ either to emulate a sequence or to emulate a mapping; the difference is that for
16021602
a sequence, the allowable keys should be the integers *k* for which ``0 <= k <
16031603
N`` where *N* is the length of the sequence, or slice objects, which define a
16041604
range of items. It is also recommended that mappings provide the methods
1605-
:meth:`keys`, :meth:`values`, :meth:`items`, :meth:`has_key`, :meth:`get`,
1605+
:meth:`keys`, :meth:`values`, :meth:`items`, :meth:`get`,
16061606
:meth:`clear`, :meth:`setdefault`,
16071607
:meth:`pop`, :meth:`popitem`, :meth:`copy`, and
16081608
:meth:`update` behaving similar to those for Python's standard dictionary
@@ -1618,8 +1618,8 @@ repetition) by defining the methods :meth:`__add__`, :meth:`__radd__`,
16181618
described below; they should not define other numerical operators. It is
16191619
recommended that both mappings and sequences implement the :meth:`__contains__`
16201620
method to allow efficient use of the ``in`` operator; for mappings, ``in``
1621-
should be equivalent of :meth:`has_key`; for sequences, it should search through
1622-
the values. It is further recommended that both mappings and sequences
1621+
should search the mapping's keys; for sequences, it should search
1622+
through the values. It is further recommended that both mappings and sequences
16231623
implement the :meth:`__iter__` method to allow efficient iteration through the
16241624
container; for mappings, :meth:`__iter__` should be the same as
16251625
:meth:`keys`; for sequences, it should iterate through the values.

Doc/tutorial/datastructures.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,7 @@ using a non-existent key.
385385
The :meth:`keys` method of a dictionary object returns a list of all the keys
386386
used in the dictionary, in arbitrary order (if you want it sorted, just apply
387387
the :meth:`sort` method to the list of keys). To check whether a single key is
388-
in the dictionary, either use the dictionary's :meth:`has_key` method or the
389-
:keyword:`in` keyword.
388+
in the dictionary, use the :keyword:`in` keyword.
390389

391390
Here is a small example using a dictionary::
392391

0 commit comments

Comments
 (0)