Datetime operation in itertools count
8 Feb
2022
8 Feb
'22
4:43 p.m.
I wanted to generate all the dates between two date ranges for which I was using count function in the itertools and to my surprise count function doesn't support datetime operation. For example
import datetime from itertools import count count(datetime.date.today(), datetime.timedelta(1))
Why is count function only limited to numbers shouldn't we make it generic that it should support operation like datetime where addition between the objects is possible. Would like to hear thoughts from you people.
797
Age (days ago)
800
Last active (days ago)
17 comments
6 participants
participants (6)
-
Aman Pandey
-
Chris Angelico
-
Christopher Barker
-
David Mertz, Ph.D.
-
Paul Moore
-
Stephen J. Turnbull