Getting a class attribute
Roger Hansen
rogerha at ifi.uio.no
Fri Mar 24 09:06:57 EST 2000
Hi all.
I have a little problem here described by a simple example inspired by
the FAQ:
class Foo:
def __init__(self, a):
self.a = a
def degree_sin(self, deg):
return math.sin(deg * math.pi / 180.0)
def degree_si2(self, deg, factor = math.pi/180.0, sin = math.sin):
return sin(deg * factor)
def degree_sin3(self, deg):
return math.sin(deg * self.a * math.pi / 180.0)
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?
R
More information about the Python-list
mailing list