>> I checked in what I thought was a fix for calendar.py and >> test_calendar.py, then realized it didn't handle slices. Tim> Why does that matter? calendar.__all__ doesn't export Tim> _localized_name or any of the gimmicks built from it, so it's Tim> purely an internal issue, and the internals never need slices here Tim> (granted that day_name etc are poorly named for module privates -- Tim> or perhaps the __all__ list and the docs are in error). Correct, but people still know they exist. I've used them a lot in my own code. It's just "well known" that they contain the weekday and month names. They were traditionally lists, so in my mind, they should probably try and behave as much like lists as is reasonable. Maybe they should be documented and exported in __all__, but that's a separate question. I'm not sure I've ever used the objects the module actually advertises except when working on the module's code. ;-) >> 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: >> ... Tim> Now this changes the current semantics in a major way: if you're Tim> going to precompute all the values, construct plain tuples instead Tim> and be done with it. I assume that whoever patched this to begin Tim> with deliberately recomputed localized values on each dynamic Tim> reference so that they would respond appropriately to dynamic Tim> locale changes. Thanks, I hadn't considered that the locale might change dynamically. The above code is not what's checked in, however. The code I checked in still calls strftime from __getitem__. I also realized later (after the checkin) that the original SF submission was a patch submission, not a bug report that didn't include a fix. (When you visit patches or bugs by clicking on links in email messages they look just about the same.) Accordingly, there was some example code there to get me over the __getslice__ hump. 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