[PEAK] Trellis and datetime.datetime

Sergey Schetinin maluke at gmail.com
Fri Jan 2 20:29:14 EST 2009


I thought about it but couldn't come up with a more complex example
where timezone change should have triggered the dependent rules. I'm
mostly just curious, but I'd really like to see the more complex case.
If you could show one it would be great.
Thanks.

On Sat, Jan 3, 2009 at 02:09, Jeffrey Harris <jeffrey at osafoundation.org> wrote:
> 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
>



-- 
Best Regards,
Sergey Schetinin

http://s3bk.com/ -- S3 Backup
http://word-to-html.com/ -- Word to HTML Converter



More information about the PEAK mailing list