What is string interning?
Variables, references, and memory model
Audio flashcard · 0:17Nortren·
What is string interning?
0:17
String interning is an optimization where Python keeps a single copy of certain strings in memory and reuses them. Short strings that look like identifiers are typically interned. You can force interning with the sys.intern function. Interned strings can be compared by identity, which is faster than character comparison.
docs.python.org