[Python-Dev] dateutil

Jewett, Jim J jim.jewett at EDS.COM
Wed Mar 17 11:28:13 EST 2004


Tim Peters:

> "go to weekday N" isn't controversial,

...

>    Example:  Sundays in November.  The day part of the date is
>    irrelevant.  Note that a "too large" index simply spills over to
>    the next month.

In my experience, most meeting planners either skip the meeting
that month, or move it up a week (so that they really wanted -1,
even if they don't say it that way).  These both differ from your
suggestion, which means it is controversial.

Greg Ewing:

>> However, in my datetime classes, I also have a very complete 
>> set of calls like: startOfMonth, endOfMonth, startOfYear, 
>> endOfYear, lastWeekday, nextWeekday, etc...

> That's good. Having two completely different ways of expressing the
> same thing seems like Too Many Ways To Do It, though, especially if
> this stuff is to be included in the standard library.

The logging library exposes several names for the name objects.
CRITICAL = FATAL; WARN = WARNING.

A single spelling is desirable, but not at the cost of more surprise
somewhere else. 

> Also, I don't understand why the "weeks" parameter isn't used to
> adjust the number of weeks here, instead of supplying it in a rather
> funky way as a kind of parameter to a parameter. 

>   relativedelta(day = MO(+3))

> why not

>   relativedelta(day = MO, weeks = +2)

Do you add weeks to the current day, or to the "start"
of the current week?

M	T[1]	W	Th[2]	F 
M	T	W	Th	F 
M	T[3]	W	Th[4]	F 
M	T[5]	W	Th	F 

>From T[1], do you mean Th[4] (counting the current partial week)?
If so, does starting at Th[2] and asking for Tuesday take you to
T[3] or T[5]?

I'm willing to believe that there is a perfectly sensible answer;
I'm not ready to believe that everyone will have agree on what it
is before talking it out.

Gustavo Niemeyer (answering Christian Tanzer):

>[
>	Adding a month to Jan 31 = Feb 29 (last day of Feb)
>	Adding a month to Feb 29 = Mar 29.
>]

But adding two months to Jan 31 = Mar 31

I've debugged code (not in python) that got to production
falsely assuming that x + 2 == x+1+1

Using negatives to count from the end is less surprising.

-jJ



More information about the Python-Dev mailing list