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 skip.montanaro
Recipients skip.montanaro
Date 2007-09-01.19:19:33
SpamBayes Score 0.31208885
Marked as misclassified No
Message-id <1188674374.08.0.925919990107.issue1083@psf.upfronthosting.co.za>
In-reply-to
Content
I discovered the hard way today that this won't work:

>>> import datetime
>>> d = datetime.timedelta(1)
>>> d / 2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for /: 'datetime.timedelta' and 'int'

The error message is misleading, because in fact timedelta
objects *do* support division by ints, just not with the
/ operator:

>>> d // 2
datetime.timedelta(0, 43200)

Is there some way the error message can be improved,
perhaps by identifying the denominator as effectively
a float?
History
Date User Action Args
2007-09-01 19:19:34skip.montanarosetspambayes_score: 0.312089 -> 0.31208885
recipients: + skip.montanaro
2007-09-01 19:19:34skip.montanarosetspambayes_score: 0.312089 -> 0.312089
messageid: <1188674374.08.0.925919990107.issue1083@psf.upfronthosting.co.za>
2007-09-01 19:19:34skip.montanarolinkissue1083 messages
2007-09-01 19:19:33skip.montanarocreate