Tag

list-issues

1 views collected around this technical thread.

Raymond Ops
Raymond Ops
Apr 25, 2025 · Fundamentals

Understanding Python’s `is` Operator, re.sub quirks, and list pitfalls

This article explains why Python’s `is` operator yields True or False for integers, how integer caching and code‑block scope affect object identity, uncovers a subtle misuse of re.sub’s count parameter, clarifies lstrip’s character‑wise stripping, and demonstrates the pitfalls of creating nested lists with the `[*] * n` syntax.

Pythonlist-issuesobject-identity
0 likes · 7 min read
Understanding Python’s `is` Operator, re.sub quirks, and list pitfalls