• 0 Posts
  • 1 Comment
Joined 2 years ago
cake
Cake day: September 5th, 2023

help-circle
  • lot of copied variables, because of c I suppose? Things like var = self.var

    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.var lookup, 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 = var is a necessary thing (to bring the var into the right context for the pre-processor to recognize it; yes, I’ve seen this…)