python-features
How Strings Compile
String operations, slicing, and formatting.
Published May 30, 2026
Concatenation
+ with two strings allocates and copies.
Slicing
s[start:end] creates a new string substring.
Comparison
== uses memcmp for equal-length strings.
Formatting
f-strings compile to concatenation chains.