New submission from Skip Montanaro: 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? ---------- components: Interpreter Core messages: 55566 nosy: skip.montanaro severity: normal status: open title: Confusing error message when dividing timedelta using / type: behavior __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1083> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com