[Python-Dev] dateutil

Christian Tanzer tanzer at swing.co.at
Mon Mar 15 12:28:00 EST 2004


> > Why don't you use "d + relativedelta(day=-1)" instead?
> >
> > Just as easy to use, better error detection, and a big precedent.
>
> Supporting this might be cool indeed. OTOH, it doesn't replace the
> current behavior. How do you get (day=30)?

I don't follow. The semantics would be similar to list indexing.

`day=30` asks for the 30-est day of the month and raises an ValueError
if there isn't any. `day=-1` asks for the last day of the month (and
should never raise an error <wink>).

The allowed argument range for `day` would be between 1 and `n` with
`n` the number of days in the month for positive values and between -1
and `-n` for negative values.

-- 
Christian Tanzer                                    http://www.c-tanzer.at/




More information about the Python-Dev mailing list