More puzzling behavior while subclassing datetime

insyte at gmail.com insyte at gmail.com
Thu Nov 16 11:52:52 CET 2006


> Yes. Consider:
>
> >>> def today(time=None, *args):
> ...     print "time = ", time, "args = ", args
> ...
> >>> today(2006, 11, 16)
> time =  2006 args =  (11, 16)
>
> To fix the issue you'll probably have to remove the time=None parameter from
> GeneralizedTime.__new__() and instead extract it from args or kwargs.

D'oh.  That *should* have been obvious.

I am now no longer allowed to program after midnight.

Thanks!

-Ben




More information about the Python-list mailing list