summaryrefslogtreecommitdiffstats
path: root/Doc/glossary.rst
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2010-12-17 20:19:50 (GMT)
committerRaymond Hettinger <python@rcn.com>2010-12-17 20:19:50 (GMT)
commit09f44140aa317cb06f13f366fd27e19613375734 (patch)
treeee70c018000115cef58865165180239752ded735 /Doc/glossary.rst
parent401edd69cf23f7f102aece55e05157daf1b87f9f (diff)
downloadcpython-09f44140aa317cb06f13f366fd27e19613375734.zip
cpython-09f44140aa317cb06f13f366fd27e19613375734.tar.gz
cpython-09f44140aa317cb06f13f366fd27e19613375734.tar.bz2
Expand the LBYL glossary entry.
Diffstat (limited to 'Doc/glossary.rst')
-rw-r--r--Doc/glossary.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/glossary.rst b/Doc/glossary.rst
index a051fe8..4958d3b 100644
--- a/Doc/glossary.rst
+++ b/Doc/glossary.rst
@@ -392,6 +392,12 @@ Glossary
the :term:`EAFP` approach and is characterized by the presence of many
:keyword:`if` statements.
+ In a multi-threaded environment, the LBYL approach can risk introducing a
+ race condition between "the looking" and "the leaping". For example, the
+ code, ``if key in mapping: return mapping[key]`` can fail if another
+ thread removes *key* from *mapping* after the test, but before the lookup.
+ This issue can be solved with locks or by using the EAFP approach.
+
list
A built-in Python :term:`sequence`. Despite its name it is more akin
to an array in other languages than to a linked list since access to