[Python-Dev] Patch review: [ 1100942 ] datetime.strptime constructor added

Alan Green alan.green at gmail.com
Thu Jan 27 01:27:03 CET 2005


I see a need for this patch - I've had to write
"datetime(*(time.strptime(date_string, format)[0:6]))" far too many
times.

I don't understand the C API well enough to check if
reference counts are handled properly, but otherwise the
implementation looks straight forward.

Documentation looks good and the test passes on my machine.

Two suggestions:

1. In the time module, the strptime() function's format
parameter is  optional. For consistency's sake, I'd expect
datetime.strptime()'s format parameter also to be optional.
(On the other hand, the default value for the format is not
very useful.)

2. Since strftime is supported by datetime.time,
datetime.date and datetime.datetime, I'd also expect
strptime to be supported by all three classes. Could you add
that now, or would it be better to do it as a separate patch?

Alan. 
-- 
Alan Green 
alan.green at cardboard.nu - http://cardboard.nu


More information about the Python-Dev mailing list