I agree with the Karen's comment when she closed your ticket wontfix.
There is no absolute answer to this question; no matter what value you
choose, there will be inconveniences. The conversion - if it is
required - isn't an expensive or difficult one. You insist that
'standards' are converging on Monday as the start of the week, but you
don't actually cite any of these "standards". In fact, to the contrary
- the APIs surveyed in #7672 show Sunday=1 is the only option
available to every database backend and Python, and in many cases,
both interpretations are possible.
I don't see any advantage in changing to a different starting day at this point.
Yours,
Russ Magee %-)
> On Thu, Mar 5, 2009 at 7:13 PM, Semmel <Florian...@web.de> wrote:
>>
>> 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
> ...
>> 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.
>
> I agree with the Karen's comment when she closed your ticket wontfix.
> There is no absolute answer to this question; no matter what value you
> choose, there will be inconveniences. The conversion - if it is
> required - isn't an expensive or difficult one. You insist that
> 'standards' are converging on Monday as the start of the week, but you
> don't actually cite any of these "standards".
The standard is ISO 8601 which is also implemented in several national
and institutional standards [1] -- including EU, Japan, Canada,
Australia and the US.
> In fact, to the contrary
> - the APIs surveyed in #7672 show Sunday=1 is the only option
> available to every database backend and Python, and in many cases,
> both interpretations are possible.
Excuse my ignorance, but if both cases are supported, why choosing the
option with less use worldwide?
Cheers,
Jannis
To prevent repetitions of %7+1 code like the example given in Semmel's
ticket[3], I think a cleaner approach would be to let the week_day filter
take a date parameter as an alternative to int (it would then have the sense
of "same week-day as"). This is a little like the license to use either keys
or objects when filtering by foreign keys.
Just my 2 cents,
Shai.
[1] http://code.djangoproject.com/ticket/7980
[2] http://code.djangoproject.com/ticket/7672#comment:3
[3] http://code.djangoproject.com/ticket/10345
I missed Semmel's original reference to ISO8601.
>> In fact, to the contrary
>> - the APIs surveyed in #7672 show Sunday=1 is the only option
>> available to every database backend and Python, and in many cases,
>> both interpretations are possible.
>
> Excuse my ignorance, but if both cases are supported, why choosing the
> option with less use worldwide?
Both options are supported _in many cases_. Not _all_ cases. The
Sunday=1 case is supported by all the backends.
Semmel and yourself both hang your arguments on the claim that Monday
as the start of the week is the "most supported" option, or the "most
common" option. I simply don't see any evidence that this is the case.
ISO8601 may well define Monday as the first day of the week, but
that's hardly the last word in the matter. Python itself offers two
methods for determining weekday (weekday() and isoweekday()). Common
usage (in Australia, at least) is hardly universal in nominating
Monday as the first day of the week.
However, for me, this is almost completely a bikeshed discussion. I
responded because I noticed the original reopen of the ticket, and I
didn't want Semmel's message to go completely unanswered. Karen made a
decision. Her decision works as designed, and it reflects the options
commonly available to database backends. Beyond that, I can't say I
really care that much - as Karen and I have both said, no matter what
decision is made, somebody isn't going to be happy, but the good news
is that the calculation required to rectify results isn't that hard.
Yours,
Russ Magee %-)
I was always under an impression that Sunday is considered first day of
week only in US. Now Wikipedia (though not the English version) says
it's also the case for Canada and Israel. But it's still a minority.
What about Australia, Russell?
Like all interesting questions, the answer is "it depends" :-)
Printed wall calendars almost universally put Sunday as the first box
in the week. However, a quick straw poll of the people in my office
gave opinions 50/50 each way, but everyone agreed that either was just
as valid and common.
Yours,
Russ Magee %-)
In Israel, as well as most Arab countries, Sunday is a business day, so Monday
as first day doesn't even make sense.
(My earlier suggestion notwithstanding, I support the core developers'
position that it doesn't _really_ matter. Due diligence: I'm in Israel, so
the current decision happens to be convenient, too).
We will always strive to avoid backwards incompatibilities, but the
official guarantee is based on released versions. So - strictly, we
have a window of opportunity where we could change this, but we're not
going to make such changes without a very good reason, such as a
clearly flawed API.
Yours,
Russ Magee %-)
I think that would be a very good compromise. I'll happily work on a
patch if the consensus is to accept 0 and 7 as numbers for Sunday.
Best,
Jannis
On Mon, 2009-03-09 at 03:20 -0700, Semmel wrote:
> On Mar 6, 7:24 am, Russell Keith-Magee <freakboy3...@gmail.com> wrote:
> > Both options are supported _in many cases_. Not _all_ cases. The
> > Sunday=1 case is supported by all the backends.
>
> Imho that's no real argument. Yeah, i can understand why this was
> choosen in the first way (because it's somehow easier to implement)
> but there's one thing we should not forget. The case where Monday is
> the first day of the week is based on "real" standards (things you can
> read, print out, refer to)
So what??? Nobody actually does print out those standards and read them
and it takes approximately 3 seconds, if you think very slowly, to be
able to handle Sunday as the first day of the week if you were
previously handling Monday.
There are some libraries that expect Monday to be the first day of the
week and others that expect to it to be Sunday. You'll never be able to
close your eyes and always use one value, so, in that respect, it
doesn't matter what we choose.
> whereas Sunday as the first day of the week
> isn't anything even near a standard - it just evolved over time. So
> from a developers point of view it's better to settle on something
> that is well defined.
Sunday is very well defined. There's absolutely no ambiguity over which
day of the week Sunday is. There is, however, quite genuine ambiguity
over which day of the week is "expected" to be the first day of the week
as even a casual perusal of this thread would show.
A sentence saying "the first day of the week is Sunday" in the docs will
not be misunderstood, believe me.
[...]
> Well maybe it's not the "most supported" or "most common" option, we
> don't know that for certain. But it's the option that most of
> developers can use without(!) a conversion so i think we should go for
> that.
Basic logic: If it's not most supported or most common, then that
assertion is pretty much false by definition. The choices are basically
between Monday and Sunday, not Monday and Thursday or something. So if
Monday isn't the most common, Sunday will be.
>
> By the way:
> Has anyone even noticed that in Python both weekday() and isoweekday()
> use Monday as the first day of the week???
Perhaps you could check ths sarcasm at the door? Everybody who's
responded in this thread has exhibited intelligence towards you.
> So i think there should be
> no discussion about this anyway. Just use Python's standards and we're
> set.
Or we could just use the value that matches what a number of our
databases (and a number of other programs) use and we're also set, since
it works well with all other code using those databases.
>
> > However, for me, this is almost completely a bikeshed discussion. I
> > responded because I noticed the original reopen of the ticket, and I
> > didn't want Semmel's message to go completely unanswered. Karen made a
> > decision. Her decision works as designed, and it reflects the options
> > commonly available to database backends. Beyond that, I can't say I
> > really care that much - as Karen and I have both said, no matter what
> > decision is made, somebody isn't going to be happy, but the good news
> > is that the calculation required to rectify results isn't that hard.
>
> Just one question: WHY should it reflect the options available for the
> database backends?
You're simply answering a question with a question, in effect. It's an
essentially arbitrary decision, since there are arguments both ways.
Yes, you've added your own weights to the arguments, but at least
acknowledge that two sides exist. When it comes down to "why one or the
other" between two roughly equal choices, you can always ask "why not
the other way" and the answer is because we chose the way we did. You
can see from the history of this code that the decision was made
intentionally.
> Since you want to work with that stuff on Python's
> side it should reflect the options given by Python. So that makes
> absolutely no sense!
Incorrect, as noted above and elsewhere in this thread.
> That's no discussion about wether one will be unhappy or not - it's
> just against common sense.
No, it isn't. Please stop characterising people disagreeing with you as
being against "common sense" and "weird". Logical arguments have been
used throughout; you happen not to agree with them, but that doesn't
make the alternative side nonsensical.
> That's why i find that decision so weird.
> I respect Karen's decision but it don't think that all points where
> thought through.
No. All of the points were thought through. it's just coming down to
people not agreeing with you that it's worth changing. There's a huge
difference. There is really no technical difference between which choice
we make (since our code doesn't run on top of paper standards that most
programmers would not even be able to name).
>
> Just to note: I am pushing this discussion as we will be stuck with it
> when 1.1 is released and i don't want this to happen with an imho
> flawed implementation.
Deal with it, frankly. It's not flawed, it's a choice. You've said
that's your opinion and everybody respects that. It just isn't enough of
a justificaiton to change things.
Let's move on.
Malcolm