Datetime utility functions

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Tue Sep 16 12:21:53 EDT 2003


On Tue, 16 Sep 2003 11:28:58 -0400, rumours say that "Tim Peters"
<tim.one at comcast.net> might have written:

>[Christos TZOTZIOY Georgiou]
>> 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.)
>
>It's OK to use replace:  datetime and date (also time and timedelta) objects
>are immutable -- their values can't be changed after initialization.  In
>particular, x.replace() doesn't mutate x.

In some strange, unprecedented and inexplicable way, you are right...
<sigh> ...again :)  RTFM-F virus not removed yet.

PS That bang thingie (!) in Ruby is pythonic.
-- 
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.




More information about the Python-list mailing list