calendar.py doesn't use lists???
Raymond Hettinger
python at rcn.com
Mon May 6 16:38:52 EDT 2002
> Seriously, though, isn't regenerating month names on every access
> a bit over the top? Why not just generate real lists once and provide
> some function that can regenerate them if and when the locale changes?
>
> How many applications have locale changes in the middle of a process
> run?
If it bugs you, add a cache to _localized_name:
class _localized_name:
def __init__(self, format):
self.format = format
self.cache = {}
def __getitem__(self, item):
return self.cache.setdefault(item,
strftime(self.format, (item,)*9).capitalize())
> This reminds me of a story in "The Mythical Man Month" where part
> an IBM operating system kernel was devoted to dealing with daylight
> savings time (back when bytes costed multiple hundred dollars and core
> was measured in K's).
Are you saying that printing calendars is in the same
"performance critical" league as the IBM OS kernel?
> Just had to gripe again. -- Aaron Watters
Hope you feel better <wink>.
Raymond Hettinger
More information about the Python-list
mailing list