[icalendar-checkins] r19617 - in iCalendar/trunk: doc
src/icalendar
Max M
maxm at mxm.dk
Wed Mar 15 21:09:19 CET 2006
dreamcatcher at codespeak.net wrote:
>Author: dreamcatcher
>Date: Mon Nov 7 21:41:55 2005
>New Revision: 19617
>
>- Changed UTC tzinfo to a singleton so the same one is used everywhere
>
>
Hi Sidney,
I find the above behaviour confusing.
The problem is the difference here: "FixedOffset()", "LocalTimezone()",
"UTC".
Two timezones are classes and a single one is an object.
You changed UTC from a class to an object to make a singleton out of it.
Why was that necessary? Do you use it for equality comparison somewhere?
If it is only for a minor speedup, I think that will be offset by
programmers spending time figuring out the difference.
In that case I would have found it better if you made an instance an
called it "utc" or something like that.
class UTC(tzinfo):
"""UTC tzinfo subclass"""
def utcoffset(self, dt):
return ZERO
def tzname(self, dt):
return "UTC"
def dst(self, dt):
return ZERO
utc = UTC() # singleton
Is there any major complaints if i change it to that?
It *is* only a 0.11 version, so backwards incompatible changes should be ok.
The fix is also easy for packages using it.
from icalendar import utc as UTC
A backwards compatible fix would be to add a call method to the class:
def __call__(self):
"FixedOffset and LocalTimezone are both classes."
pass
But that feels a bit hackish.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
Phone: +45 66 11 84 94
Mobile: +45 29 93 42 96
More information about the icalendar-checkins
mailing list