Raymond Hettinger added the comment: Perhaps: _cache.pop(next(iter(_cache)))
The for-loop version indirect about what it is trying to do and relies on an obscure quirk of exactly when it is an error to mutate while iterating. I do like that the side-effect of the compact dict is that is lets us choose the oldest entry to evict. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28293> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com