this post was submitted on 25 Nov 2025
330 points (99.4% liked)
Programmer Humor
27506 readers
1529 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
If we're very charitable, there's a micro-optimization w/ Python (or at least, older Python) where assigning to a local variable like this inside a method is faster than the full
self.varlookup, so you'll see it in Python's library code while setting up some loops, etc. as a small speedup. "lots of copied variables", though, is likely an anti-pattern if not in a heavily used piece of library code, imo.What's really crazy is when people write modified Python language pre-processors where:
var = varis a necessary thing (to bring thevarinto the right context for the pre-processor to recognize it; yes, I've seen this...)