Message201158
| Author |
belopolsky |
| Recipients |
Arfrever, Martin.Morrison, Matthew.Earl, belopolsky, brett.cannon, docs@python, hynek, pconnell, pitrou, swalker, vstinner |
| Date |
2013年10月24日.17:08:23 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1382634503.77.0.716938480537.issue19376@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> what's the reason for accepting the time.strptime()
> version as a bug, but not datetime.datetime.strptime()?
In case of time.strptime(), we have an option of returning (1900, 2, 29, ..) which while not being a valid date, is a valid (time)tuple:
>>> time.mktime((1900, 2, 29, 0, 0, 0, 0, 0, 0))
-2203873200.0
The time module treats 1900-02-29 as 1900年03月01日:
>>> time.mktime((1900, 3, 1, 0, 0, 0, 0, 0, 0))
-2203873200.0
Datetime is stricter than that:
>>> datetime(1900, 2, 29)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: day is out of range for month
There is no valid datetime value that can reasonably be returned from datetime.strptime('Feb 29', '%b %d'). |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年10月24日 17:08:23 | belopolsky | set | recipients:
+ belopolsky, brett.cannon, pitrou, vstinner, Arfrever, swalker, docs@python, hynek, Martin.Morrison, pconnell, Matthew.Earl |
| 2013年10月24日 17:08:23 | belopolsky | set | messageid: <1382634503.77.0.716938480537.issue19376@psf.upfronthosting.co.za> |
| 2013年10月24日 17:08:23 | belopolsky | link | issue19376 messages |
| 2013年10月24日 17:08:23 | belopolsky | create |
|