From 578b0ef2fd407201ad1181a64ee0984b3480a4fa Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 11 Apr 2017 16:57:18 +0200 Subject: [#8530] convert dict.has_key Redundant with `in` and removed from Python 3. Removed odd, old and long-unused UpdatableDict (which defines and uses has_key) and UpdatableStr (which was nearby and caught in the blast), validated with al. (lib2to3.fixes.fix_has_key) --- doc/python3.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'doc/python3.rst') diff --git a/doc/python3.rst b/doc/python3.rst index 55047f16d4b..b339e0a98b0 100644 --- a/doc/python3.rst +++ b/doc/python3.rst @@ -98,3 +98,14 @@ Removed Operators These two operators were long recommended against/deprecated in Python 2, Python 3 removed them from the language. + +Removed/renamed methods +----------------------- + +.. important:: + + * the ``has_key`` method on dicts must be replaced by use of the ``in`` + operator e.g. ``foo.has_key(bar)`` becomes ``bar in foo``. + +``in`` for dicts was introduced in Python 2.3, leading to ``has_key`` being +redundant, and removed in Python 3. -- cgit v1.2.3