Bugs item #1496315, was opened at 2006-05-28 02:26 Message generated for change (Comment added) made by bcannon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1496315&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Markus Gritsch (markus_gritsch) Assigned to: Brett Cannon (bcannon) Summary: strptime: wrong default values used to fill in missing data Initial Comment: The documentation of strptime() says: """The default values used to fill in any missing data are (1900, 1, 1, 0, 0, 0, 0, 1, -1)""". As the example below shows, this is not the case. Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> time.strptime('', '') (1900, 1, 1, 0, 0, 0, 0, 1, -1) >>> time.strptime('2006', '%Y') (2006, 1, 1, 0, 0, 0, 6, 1, -1) >>> time.strptime('2006-05', '%Y-%m') (2006, 5, 1, 0, 0, 0, 0, 121, -1) >>> time.strptime('2006-05-26', '%Y-%m-%d') (2006, 5, 26, 0, 0, 0, 4, 146, -1) >>> time.strptime('2006-05-26 21', '%Y-%m-%d %H') (2006, 5, 26, 21, 0, 0, 4, 146, -1) >>> time.strptime('2006-05-26 21:06', '%Y-%m-%d %H:%M') (2006, 5, 26, 21, 6, 0, 4, 146, -1) >>> time.strptime('2006-05-26 21:06:11', '%Y-%m-%d %H:%M:%S') (2006, 5, 26, 21, 6, 11, 4, 146, -1) ---------------------------------------------------------------------- >Comment By: Brett Cannon (bcannon) Date: 2006-05-30 19:22 Message: Logged In: YES user_id=357491 Rev. 46569 has more clear wording for HEAD and rev. 46570 has it for 2.4 . ---------------------------------------------------------------------- Comment By: Brett Cannon (bcannon) Date: 2006-05-28 11:29 Message: Logged In: YES user_id=357491 The docs need to be fixed to say those are the default values except when strptime() can infer better ones. There is a lot of smarts in the algorithm that do calculations to fill in missing data as best as possible, and that is what is happening here. Thanks for the bug report. I will try to fix this some time this week. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1496315&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com