Hi fellow developers. I think that the choice for Sunday being the first day of the week is an obvious but really bad choice.
View my ticket here: http://code.djangoproject.com/ticket/10345 My thoughts about this: --- #7672 introduced a new lookup type for weekdays that was committed in [9818]. The problem are that values that it uses. There already was some discussion about the values but they eventually settled on Sunday=1 and Saturday=6. Imho this is not the best decision. Of course it is obvious that they ended up with these values because that's what the databases are using mostly but there are problems when used with e.g. Python internals. Python always starts with Monday being the first day of the week whether you use weekday() (Monday=0) or isoweekday() (Monday=1). The Python behaviour also conforms to national/international standards and recommendations like ISO 8601 or DIN 1355 where it also starts with Monday being the first day of the week. I looked at the code and i know that it requires some conversion and changes for this but it would be even worse if you had to do that conversion every time you're using that django feature. So my suggestions is to change the behaviour to that of Python's weekday(). --- - The "external" representation of weekday is derived from the internal use of weekday. So the abstraction is wrong because you work with Django's objects - not with the database directly. That's no good code. It shouldn't rely on each other or at least one should not rely on the other. - There is no standard for databases that says Sunday should be the first day of the week. So what happens if there is going to be a standard (that's likely going to be Monday as the first day of the week - see next point)? Will the code be changed? Of course not - but you'll need to do a conversion on both sides of the code. That makes it clear why the previous point is so important. - Monday as the first day currently is the de facto Standard for nearly everything and it's getting more and more common. Beside the databases there are only few things that implement it that way (as far as i know). - There are official standards (as i stated in my previous statement) for this. And they all say that Monday is the first day of the week. Most of the time it's better to rely on official rather than de facto standards (that, in fact, are only used by a few databases). - You always have to make a conversion when you work with it (as shown in your example). Of course that conversion is trivial (as you showed us) but it's something you have to do every time! That's no good code either. Recurring code like this should go inside the implementation (Django) and does not belong in the user's code (to take the complexity and unnecessary work out of user's code). --- I think that this choice is not good in anyway as i stated above. Any suggestions or other opinions? If you have a different view on things please tell me why. Regards Semmel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---