[Python-Dev] Re: dateutil

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Mar 15 19:50:07 EST 2004


Paul Moore <pf_moore at yahoo.co.uk>:

>     dateutil.adjust(d, day=1)
>     dateutil.adjust(d, day=-1)
>     dateutil.adjust(d, day=1, months=+1, days=-1)
> 
> Does this look any better?

Yes, I think it does. At least it avoids giving any spurious
impression that there might be an algebra lurking around
somewhere.

It might be better to have separate functions for absolute
and relative adjustments, e.g.

  dateutil.set(d, day=1)
  dateutil.add(d, months=+1, days=-1)

since the difference between the singular and plural keywords
is rather subtle and easy to miss.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list