Getting a class attribute

Oleg Broytmann phd at phd.russ.ru
Fri Mar 24 09:16:46 EST 2000


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)

Oleg.
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list