Datetime utility functions
Paul Moore
pf_moore at yahoo.co.uk
Tue Sep 16 15:26:01 EDT 2003
Christos "TZOTZIOY" Georgiou <tzot at sil-tec.gr> writes:
> I sent my own version without having seen your own --and mine might seem
> obfuscated, compared to yours. Only a minor suggestion: don't use
> dt.replace, use dt.__class__ instead, since you wouldn't want your
> function to have side-effects (that is, don't destroy the actual object
> that dt is bound to.)
dt.replace doesn't have side effects - it creates a new object. Also,
by using replace(), my version works with date, datetime, or
subclasses. Yours does too, but it sets the time component of a
datetime to zero. It's a matter of preference which behaviour is
"better", I guess.
Paul.
--
This signature intentionally left blank
More information about the Python-list
mailing list