A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-March/043133.html below:

[Python-Dev] dateutil

[Python-Dev] dateutilChristian Tanzer tanzer at swing.co.at
Mon Mar 15 10:38:15 EST 2004
> > >> >  d.forward_months(3).end_of_month()
> > >>
> > >> In dateutil, I think it's d + relativedelta(months=+1, day=1, days=-1).
> > >> Arguably, this is fairly trivial (highly non-obvious, but trivial...)
> > >
> > > Yes, it'd work, but "d + relativedelta(day=31)" would be enough.
> >
> > Hmm, I feel vaguely uncomfortable actually relying on the "round down out
> > of range values" behaviour. Presumably day=1000 would also work, and would
> > look even stranger to me :-)
>
> This was a design decision, and I confess I'm pretty satisfied
> by the results of this decision. This simple decision created
> consistent and expectable results for operations which are not
> obvious.

Why don't you use "d + relativedelta(day=-1)" instead?

Just as easy to use, better error detection, and a big precedent.

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


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4