Timezone for datetime.date objects

Chris Angelico rosuav at gmail.com
Tue Mar 1 07:03:29 EST 2022


On Tue, 1 Mar 2022 at 22:52, Morten W. Petersen <morphex at gmail.com> wrote:
>  Yep.  Well, as I said, I could create some range objects myself, and even create a little module and put it up on pypi, if I couldn't find any existing module I could use.
>
> As we're discussing this, it is clear that different points can be made, and as for the Python standard library, it is what it is today, and part of the reason I was posting this email was to see if it should be changed, amended/appended to include range.
>
> I've worked a bit with dates, date searches and so on, and having existing range classes and objects to work with, defined in the standard library, seems like a natural and useful thing.  Time, as humans have defined it with timezones, leap years, leap seconds, Denmark not following the atomic clock etc. is a bit messy, and it is easy to make mistakes creating custom code dealing with it.
>

I think a range object wouldn't be a bad thing, but it would
absolutely have to be a datetime range, NOT a date range with
timezone. For dates with timezones, the obvious interpretation to one
person is equally obviously wrong to another, and vice versa.

ChrisA


More information about the Python-list mailing list