This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Allow "datetime in date"
Type: Stage:
Components: Extension Modules Versions: Python 2.6
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: collinwinter Nosy List: collinwinter, georg.brandl
Priority: normal Keywords: patch

Created on 2007-03-12 18:58 by collinwinter, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
date_contains.patch collinwinter, 2007-03-12 18:58 Version 1, against 54295
Messages (3)
msg52186 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-12 18:58
As discussed in http://mail.python.org/pipermail/python-ideas/2007-March/000320.html, this patch adds a __contains__ method to datetime.date objects:

datetime(2007, 3, 4, x, y, z) in date(2007, 3, 4) -> True
datetime(2007, 3, 5, x, y, z) in date(2007, 3, 4) -> False

Trying to see if a date contains anything other than a datetime results in a TypeError. Patch includes docs and tests.
msg52187 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-12 21:46
Patch looks good, but the indentation of the /* nb_xyz */ comments seems to be messed up ;)
msg52188 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-13 02:12
Closing. Comparing dates and datetimes is just a bad idea. This was more a proof-of-concept than anything else.
History
Date User Action Args
2022-04-11 14:56:23adminsetgithub: 44704
2007-03-12 18:58:44collinwintercreate