Christopher Barker writes: > There have been a couple recipes on this thread for an iterator, but I > envision something like the range() object — it’s a lazy Sequence, not just > an iterator.
I would be strongly against an extension to range() itself (I think that was the original proposal), and I think we haven't even started to mix the batter let alone bake the cake for a range method on datetime (or time or date). I see the following issues that would need to be discussed: 1. clock monotonicity 2. "daylight saving" monotonicity 3. handling of "naive" datetimes (probably easy, but that's what everybody says about everything) 4. The "anywhere on earth" (AOE) "timezone" and other similar not- exactly-what-you-teach-1st-graders-about-time practices. There's probably more, but given the above, but I don't see a good reason to say anything but """what's wrong with dt = datetime(*startdate) while dt <= datetime(*enddate): do_something_with(dt) dt += timedelta(*deltaspec) """ yet. It's possible that all of the above are straightforward to deal with (2 would be messy at best with an indexable dateteime_range, though), but the monotonic clock PEP was quite a bit of work. They need to be addressed though. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/2T4OABKFKYEMD3FTY3I5ZHDOQSOBUGFP/ Code of Conduct: http://python.org/psf/codeofconduct/