On Mon, Mar 12, 2018 at 5:18 PM, Tim Peters <[email protected]> wrote:
> [Guido]
>> .... as_integer_ratio() seems mostly cute (it has Tim Peters all
>> over it),
>
> Nope! I had nothing to do with it. I would have been -0.5 on adding
> it had I been aware at the time.
>
> - I expect the audience is tiny.
The datetime module would benefit from having as_integer_ratio()
supported by more types. It's been hard to resist requests to allow
Decimal in timedelta constructors and/or arithmetics
>>> timedelta(Decimal('1.5'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported type for timedelta days component: decimal.Decimal
but
>>> timedelta(1.5)
datetime.timedelta(days=1, seconds=43200)
I don't recall why we decided not to accept anything with an
.as_integer_ratio() method.
See <https://bugs.python.org/issue14262> for additional discussion.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com