def xrange(self, unit, amount=1):
method = 'add'
op = operator.le
if not self._absolute and self.invert:
method = 'subtract'
op = operator.ge
start, end = self.start, self.end
i = amount
while op(start, end):
yield start
start = getattr(self.start, method)(**{unit: i})
i += amount
评论列表
文章目录