From: Tim Peters Date: Tue, 13 Aug 2002 23:29:21 +0000 (+0000) Subject: _once(): Simplified dict manipulation. X-Git-Tag: v2.3c1~4495 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fd0f0c9f02feeae88e648d2df483717f307ab413;p=thirdparty%2FPython%2Fcpython.git _once(): Simplified dict manipulation. --- diff --git a/Lib/tempfile.py b/Lib/tempfile.py index 32b83a0801ce..dff2ae937fc5 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: