From fd0f0c9f02feeae88e648d2df483717f307ab413 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Tue, 13 Aug 2002 23:29:21 +0000 Subject: _once(): Simplified dict manipulation. --- Lib/tempfile.py | 4 ++-- 1 file 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: -- cgit v0.12