On this page
re.purge
Prev: re.PatternError | Up: re | Next: re.RegexFlag
Rel: re.compile, re.error, re.escape, re.findall
Ref: docs.python.org — re.purge
Tags: #public #python3 #stdlib #re
Import
import re
from re import purge
Signature & Overview
re.purge()
Clear the regular expression caches
Usage
import re
re.compile(r"\d+")
re.purge() # clears the internal compiled-regex cache
Gotchas
- Rarely needed: Python caps the internal
recache automatically (512 entries); callre.purge()only when benchmarking cold regex compilation or freeing memory after generating many dynamic patterns.
REPL Inspect
from re import purge
help(purge)
Linked from
Related notes
- tuts/python3/stdlib_module/re/PatternError Linked here; links to this page; shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/RegexFlag Linked here; links to this page; shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/re/compile Linked here; shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/error Linked here; shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/escape Linked here; shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/findall Linked here; shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/finditer shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/fullmatch shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/match shared tags: #re, #stdlib