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 | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
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