Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64610
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <skip.montanaro@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.125 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.75; '*S*': 0.00; 'backwards': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'mapped': 0.16; 'which,': 0.16; 'sender:addr:gmail.com': 0.17; 'module': 0.19; '>>>': 0.22; 'import': 0.22; 'skip': 0.24; 'asking': 0.27; 'message-id:@mail.gmail.com': 0.30; 'skip:d 20': 0.34; "i'd": 0.34; 'classes': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'date.': 0.36; 'false': 0.36; 'application': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'is.': 0.60; 'took': 0.61; 'between': 0.67; 'now:': 0.74; 'surprise': 0.74; 'attention': 0.75; 'working,': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=XVmdchbgHtRQz75tKJRrfdwifyCEPEtjM10VZGvWpP4=; b=ugnB9Gsugpk4NKAV0At+Kzy3chEW0KfRl4+Oy1yhq6jDSbEHF6gaaAH/uVF5+0TEwQ oXvkR7vJjnwN5gzE6ncyuSdmokADMwYmPfDpJ9Zvcn4qNg79jdTCw8xehn5TxHKKYsAT qwp9JirAMzUJyaivyCw3AA8ua/HUGELUTX6bMAsXLDiyDzes5/szZoYtTbEKEt48/jJm 08pL84ikSu22XTsk5wk+omK07TKVWhdrjADuLH/+QGj07O7d2X8vRX1Ebpb6204Kf7o4 wxwXkBJU7MTqPRNC6oUNYpbB7bp3vxwyX9EsinkDsLuGHVQJQpUVuWlyUSXf/Tb561df 6v/w== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.147.72 with SMTP id ti8mr29707984igb.20.1390486602550; Thu, 23 Jan 2014 06:16:42 -0800 (PST) |
| Sender | skip.montanaro@gmail.com |
| Date | Thu, 23 Jan 2014 08:16:42 -0600 |
| X-Google-Sender-Auth | BcJ0NN8ewmQ83of5BswMmrDnviw |
| Subject | datetime as subclass of date |
| From | Skip Montanaro <skip@pobox.com> |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5892.1390486606.18130.python-list@python.org> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1390486606 news.xs4all.nl 2894 [2001:888:2000:d::a6]:32892 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:64610 |
Show key headers only | View raw
This took my by surprise just now: >>> import datetime >>> now = datetime.datetime.now() >>> isinstance(now, datetime.datetime) True >>> isinstance(now, datetime.time) False >>> isinstance(now, datetime.date) True >>> issubclass(datetime.datetime, datetime.date) True I'd never paid any attention to the relationship between the datetime, time, and date classes of the datetime module before now, but have an application where, for backwards compatibility, date objects must be mapped to datetime objects with a time of midnight. That wasn't working, because I was asking if a datetime instance was an instance of a date. Which, it turns out, it is. Skip
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
datetime as subclass of date Skip Montanaro <skip@pobox.com> - 2014-01-23 08:16 -0600
csiph-web