Re: Trellis and datetime.datetime
Jeffrey Harris <jeffrey-6zGkXsw2EZWGJGYlWa3Ukdi2O/[email protected]> Fri, 02 Jan 2009 16:09:00 -0800
| Newsgroups | gmane.comp.python.peak |
|---|---|
| Message-ID | <[email protected]> |
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