Alexander Belopolsky <[email protected]> added the comment:
I have updated Amaury's patch for py3k. I simplified the test for default date
values and fixed a documentation nit. (Time fileds are [4:7], not [4:6]). The
result is attached as issue1100942.diff.
Note that date.strptime accepts some time specs and time.strptime accepts some
date specs:
>>> time.strptime('1900', '%Y')
datetime.time(0, 0)
>>> date.strptime('00', '%H')
datetime.date(1900, 1, 1)
This matches the proposed documentation, but I am not sure is desirable.
I am about +0 for making the test more robust by scanning the format string and
rejecting date format codes in time.strptime and time format codes in date.
This will also allow better diagnostic messages. For example, instead of
>>> date.strptime('01', '%M')
Traceback (most recent call last):
..
ValueError: date.strptime value cannot have a time part
we can produce "'%M' is not valid in date format specification."
----------
keywords: +easy, patch
Added file: http://bugs.python.org/file17599/issue1100942.diff
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue1100942>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com