I am writing a program to simulate a small physical system and get more annoyed when I write things like this:
K = 0.5 * self.m * self.v**2
In the above case, the equation is short and pretty straightforward, but I have situations in which there is so much self that it all looks like a mess. I know that python always requires self refer to class members, but is there a way to make the code not look like self mosaic?
EDIT . I usually do things like:
var = self.var
and keep using var instead of self.var . Later I:
self.var = var
but it seems really stupid. What will be the pythonic way to solve this problem?
python
pap42
source share