[New-bugs-announce] [issue42799] Please document fnmatch LRU cache size (256) and suggest alternatives
report at bugs.python.org
Thu Dec 31 17:14:20 EST 2020
New submission from Josh Triplett <josh at joshtriplett.org>:
fnmatch translates shell patterns to regexes, using an LRU cache of 256 elements. The documentation doesn't mention the cache size, just "They cache the compiled regular expressions for speed.". Without this knowledge, it's possible to get pathologically bad performance by exceeding the cache size.
Please consider adding documentation of the cache size to the module documentation for fnmatch, along with a suggestion to use fnmatch.translate directly if you have more patterns than that.
components: Library (Lib)
title: Please document fnmatch LRU cache size (256) and suggest alternatives
versions: Python 3.9
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce