[Python-Dev] [Python-checkins] r43545 - in python/trunk: Doc/lib/libcalendar.tex Lib/calendar.py

Tim Peters tim.peters at gmail.com
Sun Apr 2 23:05:31 CEST 2006


[Tim, gripes about ...]
>>> Author: walter.doerwald
>>> Date: Sat Apr  1 22:40:23 2006
>>> New Revision: 43545
>>>
>>> Modified:
>>>    python/trunk/Doc/lib/libcalendar.tex
>>>    python/trunk/Lib/calendar.py
>>> Log:
>>> Make firstweekday a simple attribute instead
>>> of hiding it behind a setter and a getter.

[Walter][
> This is because in 2.4 there where no Calendar objects and firstweekday was
> only setable and getable via module level functions.

I didn't realize that, of course <blush>.  Skipping the rest ;-),
then, it would be best to make firstweekday a property on the new base
class.

> ...
> The only thing lost is the range check in the setter.

Which isn't a good thing to lose.  It's not good that the current
Calendar constructor skips that sanity check either ("errors should
never pass silently").

> ...
> Simple attribute access looks much more Pythonic to me than setters and gettes
> (especially as the attributes of subclasses are simple attributes).
> Or are you talking about the Calendar class itself?

Yes, it would be best if Calendar had a property, so that sanity
checks were performed when setting `firstweekday`, and also if the
Calendar constructor performed that sanity check (which could happen
"by magic" if `firstweekday` were a property).


More information about the Python-Dev mailing list