_sep()内嵌函数如何优化下,感觉不够简洁优雅
def lumpCalc_sep(self,record,oday):
pre = record.day
mon = record.month
next = dateAddmonth(pre,mon)
sum = record.money
sep = []
def _sep():
nonlocal sum,sep,pre,next,self,mon
i = self.table.icor(pre)
r = 0.0 if i<0 else self.table.getTheIrate(i,mon)
sqx = _preint(r,sum,mon)
s = self.tax(pre,next,sum,r)
sep.append([pre,next,sum,r,sqx,s])
sum += (sqx-s)
pre = next
if oday >= next:
_sep()
mon = record.again
if mon != 0:
next = dateAddmonth(next,mon)
while oday >= next:
_sep()
next = dateAddmonth(next,mon)
if pre != oday:
cur = self.cur_tax_later_sep(pre,oday,sum)
sep.append([pre,oday,sum,cur[1][0],cur[1][1],cur[1][2]])
sum += cur[0]
return sum,sep