Message23112
Logged In: YES
user_id=6380
Thanks for the fix, I knew there was something I forgot!
One comment:
[Tim]
> Can't imagine what "*looks* like a quick lookup" could mean in
> any objective sense. I assume your colleague was using "[]"
> notation. Doesn't necessarily look quick to me <wink>.
>
> Any inner loop that expects to run long enough that the
> month may change is necessarily not a critical inner loop <0.5
> wink>.
Well, the loop was something like (not literally):
for year, month, day in <source of many dates>:
monthname = calendar.month_name[month]
key = (year, monthname, day)
<now use key for look up in some other table>
The other table happened to be indexed by (year, monthname,
day) instead of using the numeric month, and IMO
calendar.month_name[month] is indeed the "obvious" way to do
the translation from numeric month to month name if you
don't want to have to type them yourself (never mind that
it's not documented -- but it's in __all__ and tested by the
test suite so I consider that a doc bug).
Since upgrading to Python 2.4 isn't in the cards anytime
soon and we don't want to go down the slippery path of
costum changes to Python, we fixed it by changing the way
the other table was indexed. |
|
| Date |
User |
Action |
Args |
| 2007-08-23 14:27:25 | admin | link | issue1065388 messages |
| 2007-08-23 14:27:25 | admin | create | |
|