Message170854
| Author |
vstinner |
| Recipients |
belopolsky, ced, ezio.melotti, rhettinger, skip.montanaro, terry.reedy, vstinner |
| Date |
2012年09月20日.21:43:09 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1348177390.66.0.222125606041.issue15421@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Hi Cédric!
while True:
yield date
- date += oneday
+ try:
+ date += oneday
+ except OverflowError:
+ break
You might add a comment explaining why we may get an OverflowError here.
I don't know the cost of adding a try/except in a loop. But the loop has 31 iterations or less, so it's maybe better to keep the explicit try/except around date += oneday.
+ def test_itermonthdates(self):
+ # ensure itermonthdates works for all months
+ list(calendar.Calendar().itermonthdates(9999, 12))
Please use datetime.MAXYEAR instead of this hardcoded constant. |
|