This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients ajaksu2, belopolsky, brett.cannon, doerwalter, eric.araujo, ggenellina, kawai, mark.dickinson, pitrou, rafe, vstinner
Date 2010-06-03.20:06:42
SpamBayes Score 3.3597233e-05
Marked as misclassified No
Message-id <AANLkTinFZtW07lxvrjUrcK4IaW-_6PkNDtSyGQBj4zRZ@mail.gmail.com>
In-reply-to <1275592558.56.0.269028568798.issue5094@psf.upfronthosting.co.za>
Content
On Thu, Jun 3, 2010 at 3:15 PM, Brett Cannon <report@bugs.python.org> wrote:
..
> As for the float/int argument, I personally am wary of it. Since the
> timedelta constructor accepts hours as a keyword argument, I don't
> see the benefit of having to support both timedeltas and int/floats.

To my taste, timedelta(hours=-5) is just too verbose.  It also forces
you to import timedelta in a module that may otherwise not need it.

> And I can see someone messing up and putting in a float that is not > perfectly representable and getting upset at odd behavior.

Since timedelta accepts floats for hours, this argument does not
really hold.  Also, with timedelta correctly rounding to the nearest
microsecond, it is really hard to mess up with binary vs. decimal
representation.

> I say keep it simple and just accept timedeltas for now. If there
> really is demand for accepting integers in the constructor than it can > be added without backwards-compatibility issues. Better to keep the > API small and expand later than make it too big to start and being
> burdened with extraneous API stuff.
>

This a valid argument.  since it is easier to remove code than to add,
I'll keep int/float support in the patch while we are discussing the
design, but I am ready to remove it.
History
Date User Action Args
2010-06-03 20:06:44belopolskysetrecipients: + belopolsky, doerwalter, brett.cannon, mark.dickinson, ggenellina, pitrou, vstinner, ajaksu2, kawai, eric.araujo, rafe
2010-06-03 20:06:42belopolskylinkissue5094 messages
2010-06-03 20:06:42belopolskycreate