Why self?

Mark McEahern marklists at mceahern.com
Tue Jul 9 14:48:08 EDT 2002


>    self.y= self.x**2 * self.t/self.z + self.a * FFT(self.tseries)
>
> is a LOT uglier than
>
>    y= x**2 * t/z + a * FFT(tseries)

Do you use emacs?  It would probably be trivial to write a Lisp macro that
would transform this:

  y = x**2 * t/z + a * FFT(tseries)

into:

  x = self.x
  t = self.t
  z = self.z
  a = self.a
  tseries = self.tseries

  y = x**2 * t/z + a * FFT(tseries)

  self.y = y

// m

-






More information about the Python-list mailing list