summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-08-13 23:29:21 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-08-13 23:29:21 (GMT)
commitfd0f0c9f02feeae88e648d2df483717f307ab413 (patch)
treec295227393dad10631b318f8d781bf9e72b06962
parent200788ce4594bb4ddf47b319f45d99c8206dc0ec (diff)
downloadcpython-fd0f0c9f02feeae88e648d2df483717f307ab413.zip
cpython-fd0f0c9f02feeae88e648d2df483717f307ab413.tar.gz
cpython-fd0f0c9f02feeae88e648d2df483717f307ab413.tar.bz2
_once(): Simplified dict manipulation.
-rw-r--r--Lib/tempfile.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index 32b83a0..dff2ae9 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -101,12 +101,12 @@ def _once(var, initializer):
lock = _once_lock
# Check first outside the lock.
- if var in vars and vars[var] is not None:
+ if vars.get(var) is not None:
return
try:
lock.acquire()
# Check again inside the lock.
- if var in vars and vars[var] is not None:
+ if vars.get(var) is not None:
return
vars[var] = initializer()
finally: