[New-bugs-announce] [issue42799] Please document fnmatch LRU cache size (256) and suggest alternatives

Josh Triplett 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)
messages: 384141
nosy: joshtriplett
priority: normal
severity: normal
status: open
title: Please document fnmatch LRU cache size (256) and suggest alternatives
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42799>
_______________________________________


More information about the New-bugs-announce mailing list