Comment

Comment by mattclarkdotnet

To clarify, it is nuts that in an object method, there is a performance enhancement through caching a member value.

  class SomeClass
    def init(self)
      self.x = 0
    def SomeMethod(self)
      q = self.x
      ## do stuff with q, because otherwise you're dereferencing self.x all the damn time

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton