[PEAK] Trellis and datetime.datetime

Jeffrey Harris jeffrey at osafoundation.org
Fri Jan 2 19:09:00 EST 2009


Hi Sergey,

> I think if you really want to depend on computed datetime's timezone,
> a much cleaner solution would be to use @property in such cases, i.e.
> 
> ...     @property
> ...     def dt(self):
> ...         return self.base_dt.astimezone(self.tzinfo)

Sure.  If all I ever wanted was a simple calculation like that, that'd
work fine, but this was just the simplest test I could come up with, not
the actual use case.  It's fairly common that I want a rule to return a
datetime.

I definitely *could* rewrite a bunch of code to always use timestamps +
timezones, I'm just exploring whether I can avoid that.

Sincerely,
Jeffrey



More information about the PEAK mailing list