Tag Archives: PyFinance
Overloading in Python Class using Bond Class
Posted by Shawn Zhang
on November 12, 2012
No comments
I'm going to have a snippet code about Construct a Bond Class using overloading technics.
Frist, we create a Bond class in Python :
class Bond:
def __init__(self, price = 0, face_value=100, maturity=0, interest_rate=0, num = 0):
self.price = price
self.face_value = face_value
self.interest_rate = interest_rate
self.maturity = maturity
self.num = num
def __repr__(self):
return ''' Bond: Price: %s Number: %s Maturity: Read more [...]