Issue 1463288: clean up new calendar locale usage (original) (raw)

Walter,

I don't know if this is really better or not. I was wondering if the new with statement would help cleanup the locale handling (all the try-finallys). It reduces the total lines of code a little bit. It seems a little cleaner to me. I didn't see any tests for the new classes, so I only tested on the command line and it seemed to work. Regardless of whether you like this patch or not, it would be good to add tests for the new classes in calendar.

I'm probably about +0 on this patch. It was more an experiment to see if the code was clearer. I think it's marginally better at most.

Logged In: YES user_id=89016

Since there's now backwards compatibility issue, and the code does read a littler better and the stdlib should be an example of Python usage, I checked in your patch as r45302 with added tests for TextCalendar and HTMLCalendar. I don't know how we could add reliable tests for LocaleTextCalendar and LocaleHTMLCalendar.