[issue5094] datetime lacks concrete tzinfo impl. for UTC

Alexander Belopolsky report at bugs.python.org
Thu Jun 3 22:06:44 CEST 2010

Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

On Thu, Jun 3, 2010 at 3:15 PM, Brett Cannon <report at 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

> 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.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list