Skip to content

Commit 250861f

Browse files
committed
Use setdefault over normal dict insertion
1 parent 317189a commit 250861f

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/flint/flint_base/flint_base.pyx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ cdef class flint_mpoly_context(flint_elem):
221221

222222
ctx = cls._ctx_cache.get(key)
223223
if ctx is None:
224-
ctx = cls(*key)
225-
cls._ctx_cache[key] = ctx
224+
ctx = cls._ctx_cache.setdefault(key, cls(*key))
226225
return ctx
227226

228227
@classmethod

0 commit comments

Comments
 (0)