fork download
  1. In 3.x:
  2.  
  3. def get_hot_pages(self, radius=2):
  4. if self.page is None or self.max_pages is None:
  5. return
  6. low = max(self.page - radius, 0)
  7. high = min(self.page + radius + 1, self.max_pages)
  8. yield from range(low, high)
  9.  
  10. In 2.x:
  11.  
  12. def get_hot_pages(self, radius=2):
  13. if self.page is None or self.max_pages is None:
  14. return []
  15. low = max(self.page - radius, 0)
  16. high = min(self.page + radius + 1, self.max_pages)
  17. return xrange(low, high)
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty