[Python-ideas] bool(datetime.time(0, 0))

M.-A. Lemburg mal at egenix.com
Tue May 8 21:55:15 CEST 2012


Terry Reedy wrote:
> On 5/8/2012 7:36 AM, M.-A. Lemburg wrote:
> 
>> It's perfectly fine for time value to mimic a boolean value
>> by following the same paradigm as a float "seconds since midnight"
>> value.
> 
> Ah, I think this is the key to the dispute as to whether midnight should be False or True. Is the
> implementation of time of day as seconds since midnight essential (then midnight should be False) or
> accidental (then midnight should be True like all other times)? Different discussants disagree on
> the premise and hence the conclusion.
> 
> If one first implements time-of-day as a number representing seconds from midnight, then
> bool(midmight) is bool(0) is False, like it or not. If one later wraps the number as a Time object,
> as Python did, then seconds from midnight and the specialness of midnight is essential for the new
> object to be a completely back-compatible drop-in replacement (with augmentations). Anyway, if 'from
> midnight' is part of the core concept of the class, the current behavior is correct.
> 
> If one starts with time-of-day as a concept independent of linear numbers, as smoothly flowing
> around a circle, then making any particular time of day (or point on the circle) special seems
> wrong. Indeed, time of day is the same as local rotation angle with respect to the sum. So it is as
> much geometric as numeric.
> 
> Abstractly, the second viewpoint seems correct. Pragmatically, however, civilized humans (those with
> clocks ;-) have standardized on local nominal midnight as the base point for numerically measuring
> time of day.

I think you have to broaden that view a bit :-)

The Julian day starts noon and in other date/time concepts, the day
starts at sunrise or sunrise, so it depends on the location as well
as the day of the year (and various other astronomical corrections).
See e.g.

    http://en.wikipedia.org/wiki/Day

The whole date/time topic is full of mysteries, oddities and very
human errors and misconceptions. It also demonstrates that there's
no single right way to capture date/time.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, May 08 2012)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2012-07-02: EuroPython 2012, Florence, Italy               55 days to go
2012-04-26: Released mxODBC 3.1.2                 http://egenix.com/go28
2012-04-25: Released eGenix mx Base 3.2.4         http://egenix.com/go27

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/



More information about the Python-ideas mailing list