[Python-Dev] datetime module enhancements (original) (raw)
BJörn Lindqvist bjourne at gmail.com
Mon Mar 12 00:09:16 CET 2007
- Previous message: [Python-Dev] datetime module enhancements
- Next message: [Python-Dev] datetime module enhancements
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 3/11/07, Steven Bethard <steven.bethard at gmail.com> wrote:
On 3/11/07, Christian Heimes <lists at cheimes.de> wrote: > I've another idea. Date and datetime objects are compared by date. The > date object for a given date is always smaller than the datetime for the > same day - even for midnight.
I really don't understand what the problem is with having a date() behave like a proper temporal interval. The only person complaining about that interpretation acknowledged that for his purposes, it would be better than the status quo. And I have yet to see a use case where being consistent with temporal interval logic is a problem.
I do not really understand proper temporal intervals. But I am interested what "temporal interval logic" has to say about this problem:
def get_most_recent_articles(articles, cutoff_date): recent_articles = [] for article in articles: if article.datetime_posted > cutoff_date: recent_articles.append(article) return recent_articles
Would temporal interval logic make it so an article with datetime(2007, 1, 1, 0, 0, 0) be included, if cutoff_date was date(2007, 1, 1)? What about articles with datetimes (2007, 1, 1, 0, 0, 1) and (2007, 1, 2, 0, 0, 0) respectively? I believe that "temporal interval logic" has to include at least the last two examples in recent_articles, otherwise it would be highly annoying.
-- mvh Björn
- Previous message: [Python-Dev] datetime module enhancements
- Next message: [Python-Dev] datetime module enhancements
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]