A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2018-March/152370.html below:

[Python-Dev] Symmetry arguments for API expansion

[Python-Dev] Symmetry arguments for API expansion [Python-Dev] Symmetry arguments for API expansionAlexander Belopolsky alexander.belopolsky at gmail.com
Mon Mar 12 18:21:30 EDT 2018
On Mon, Mar 12, 2018 at 5:18 PM, Tim Peters <tim.peters at gmail.com> 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.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4