I checked in what I thought was a fix for calendar.py and test_calendar.py, then realized it didn't handle slices. I've never dealt with __getitem__ and slices before. Would someone try out this modified version of calendar._localized_name and let me know what I'm doing wrong? class _localized_name: def __init__(self, format, len): self.data = [] for i in range(len): self.data.append(strftime(format, (i,)*9).capitalize()) # months are one-based - match 2.1 behavior if format == '%b': self.data[0] = " " elif format == '%B': self.data[0] = "" def __getitem__(self, item): if type(item) is types.SliceType: return self.data[item.start:item.stop] return self.data[item] def __len__(self): return len(self.data) For example, try something like calendar.month_abbr[-20:] Also, should I worry about the slice's step attribute? Skip
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4