Getting a class attribute
Roger Hansen
rogerha at ifi.uio.no
Fri Mar 24 10:16:53 EST 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?
R
More information about the Python-list
mailing list