Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #64663

Re: datetime as subclass of date

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: datetime as subclass of date
Date 2014-01-24 17:54 +1100
References <CANc-5Uw5z84=vAMVJaCH-KCSR=1q8_zTKuspaF2zzOG9qtVu4Q@mail.gmail.com> <mailman.5913.1390515296.18130.python-list@python.org> <roy-29B820.19102323012014@news.panix.com>
Newsgroups comp.lang.python
Message-ID <mailman.5930.1390546479.18130.python-list@python.org> (permalink)

Show all headers | View raw


Roy Smith <roy@panix.com> writes:

> Ben Finney <ben+python@benfinney.id.au> wrote:
>
> > Makes sense, since ‘datetime’ can do everything ‘date’ can do, and
> > is conceptually a subset of the same concept.
>
> That's reasonable, but given that, it's weird that date(2014, 1, 23) == 
> datetime(2014, 1, 23) is False.  You would think it should be True, in 
> the same way that 1 + 0j == 1 is True.

Hmm. It does make sense to me that ‘datetime.date(2014, 1, 23) ==
datetime.datetime(2014, 1, 23)’.

I can come up with rationalisations for why it isn't, but they're not
satisfactory. I also don't consider it a bug, though. I'm conflicted :-)

-- 
 \          “Those who write software only for pay should go hurt some |
  `\                 other field.” —Erik Naggum, in _gnu.misc.discuss_ |
_o__)                                                                  |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: datetime as subclass of date Ben Finney <ben+python@benfinney.id.au> - 2014-01-24 09:14 +1100
  Re: datetime as subclass of date Roy Smith <roy@panix.com> - 2014-01-23 19:10 -0500
    Re: datetime as subclass of date Ben Finney <ben+python@benfinney.id.au> - 2014-01-24 17:54 +1100
    Re: datetime as subclass of date Skip Montanaro <skip@pobox.com> - 2014-01-24 10:03 -0600

csiph-web