Walter Dörwald wrote:
> Tim Peters wrote:
>> 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").
>
> I've changed calendar so that firstweekday is only used modulo 7
> everywhere (There was only one spot missing, all other cases used
> firstweekday modulo 7 anyway.
>
>>> ...
>>> 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).
>
> Range checks should no longer be neccessary, as any value works now.
But now all *clients* of the Calendar class are forced to deal with the fact
that "firstweekday" may not be greater than seven.
If you want to accept any input value, why not use a property to force it to
be modulo 7, rather than doing an actual range check?
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com