[ python-Bugs-1289118 ] timedelta multiply and divide by floating point

SourceForge.net noreply at sourceforge.net
Tue Sep 13 06:11:30 CEST 2005


Bugs item #1289118, was opened at 2005-09-12 16:41
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1289118&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Daniel Stutzbach (agthorr)
>Assigned to: Tim Peters (tim_one)
Summary: timedelta multiply and divide by floating point

Initial Comment:
In python 2.4.1, the datetime.timedelta type allows for
the multiplication and division by integers.  However,
it raises a TypeError for multiplication or division by
floating point numbers.  This is a counterintutive
restriction and I can't think of any good reason for it.

For example:

>>> import datetime
>>> datetime.timedelta(minutes=5)/2
datetime.timedelta(0, 150)
>>> datetime.timedelta(minutes=5)*0.5
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: unsupported operand type(s) for *:
'datetime.timedelta' and 'float'


----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2005-09-12 23:11

Message:
Logged In: YES 
user_id=80475

Tim, do you prefer the current behavior?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1289118&group_id=5470


More information about the Python-bugs-list mailing list