On Wednesday 30 July 2008 06:35:32 Francesc Alted wrote: > A Wednesday 30 July 2008, Ivan Vilata i Balaguer escrigué: > > Pierre GM (el 2008-07-29 a les 15:47:52 -0400) va dir:: > > > On Tuesday 29 July 2008 15:14:13 Ivan Vilata i Balaguer wrote: > > > > Pierre GM (el 2008-07-29 a les 12:38:19 -0400) va dir::
[Pierre] > > > Well, what about a .tounit(new_unit, reference=None) ? > > > By default, the reference would be None and default to the POSIX > > > epoch. We could also go for .totunit (for to time unit) [Ivan] > > Yes, that'd be the signature for a method. The ``reference`` > > argument shouldn't be allowed for ``datetime64`` values (absolute > > times, no ambiguities) but it should be mandatory for ``timedelta64`` > > ones. Sorry, but I can't see the use of having a default reference, > > unless one wanted to work with Epoch-based deltas, which looks like > > an extremely particular case. Could you please show me a use case > > for having a reference defaulting to the POSIX epoch? [Francesc] > Yeah, I agree with Ivan in that a default reference time makes little > sense for general relative times. IMO, and provided that we will be > allowing an implicit casting for most of time units for relative vs > relative and in absolute vs relative, the use of forced casting will > not be as frequent, and that a function would be enough. Having said > that, I still see the merit of method for some situations, so I'll > mention that in the third proposal as a possible improvement. In my mind, .tounit(*args) should be available for both relative (timedeltas) and absolute (datetime) times. I agree that for relative times, a default reference is meaningless. However, for absolute times, there's only one possible reference, the POSIX epoch, right ? Now, what format do you consider for this reference ? Moreover, could you give some more examples of interaction between datetime and timedelta ? _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion