Getting a class attribute
rogerha at ifi.uio.no
Fri Mar 24 16:16:53 CET 2000
* Oleg Broytmann
> On 24 Mar 2000, Roger Hansen wrote:
> > def degree_sin4(self, deg, factor = self.a * math.pi/180.0, sin = math.sin):
> > return sin(deg * factor)
> > The question is how can I get "self.a" in degree_sin4?
> def degree_sin4(self, deg, factor = None, sin = math.sin):
> if factor is None:
> factor = self.a * math.pi/180.0
> return sin(deg * factor)
Thanks, but it's not what I'm looking for. My question was not precise
enough, my fault.
I want to calculate factor as a default parameter value, because I
want to speed up the method. The method will typically be called
several thousand times. It is possible to get the class atribute "a"
in the default function parameter?
More information about the Python-list