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.

Author belopolsky
Recipients ajaksu2, alanvgreen, amaury.forgeotdarc, belopolsky, guettli, josh-sf, mark.dickinson, sonderblade, tiktuk
Date 2010-06-09.15:17:21
SpamBayes Score 0.00022251779
Marked as misclassified No
Message-id <1276096645.43.0.2408957473.issue1100942@psf.upfronthosting.co.za>
In-reply-to
Content
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."
History
Date User Action Args
2010-06-09 15:17:25belopolskysetrecipients: + belopolsky, guettli, amaury.forgeotdarc, mark.dickinson, sonderblade, alanvgreen, ajaksu2, josh-sf, tiktuk
2010-06-09 15:17:25belopolskysetmessageid: <1276096645.43.0.2408957473.issue1100942@psf.upfronthosting.co.za>
2010-06-09 15:17:23belopolskylinkissue1100942 messages
2010-06-09 15:17:22belopolskycreate