[ python-Bugs-1079134 ] datetime changes missing from "Porting from 2.3 to 2.4"

SourceForge.net noreply at sourceforge.net
Mon Dec 6 22:49:28 CET 2004


Bugs item #1079134, was opened at 2004-12-05 00:29
Message generated for change (Settings changed) made by jlgijsbers
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1079134&group_id=5470

Category: Documentation
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Sadruddin Rejeb (sadrejeb)
>Assigned to: A.M. Kuchling (akuchling)
Summary: datetime changes missing from "Porting from 2.3 to 2.4"

Initial Comment:
Since Python2.4, it's impossible to compare date and 
datetime when it was possible to do so in previous 
versions. I think this changed behaviour is missing from 
the "What's new in Python 2.4" documentation and 
should figure in the "porting from 2.3 to 2.4" section. 

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2004-12-05 03:45

Message:
Logged In: YES 
user_id=31435

The truth (which is more involved than your characterization) 
is in the NEWS file:

"""
SF bug #1028306:  Trying to compare a ``datetime.date``
to a ``datetime.datetime`` mistakenly compared only the
year, month and day.   Now it acts like a mixed-type
comparison:  ``False`` for ``==``,  ``True`` for ``!=``,
and raises ``TypeError`` for other comparison operators.
Because datetime is a subclass of date, comparing only the
base class (date) members can still be done, if that's desired,
by forcing using of the approprate date method; e.g.,
``a_date.__eq__(a_datetime)`` is true if and only if the
year, month and day members of ``a_date`` and
``a_datetime`` are equal.
"""

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1079134&group_id=5470


More information about the Python-bugs-list mailing list