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 mark.dickinson
Recipients mark.dickinson, serhiy.storchaka, zach.ware
Date 2020-05-28.16:44:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1590684243.81.0.218288133784.issue40801@roundup.psfhosted.org>
In-reply-to
Content
> `operator` seems a slightly odd place for this.

Yes, it's not ideal. It's by analogy with operator.index, which provides the equivalent duck-typing for integers, and calls __index__.  Similarly, operator.as_float is primarily there to call __float__, except that now that PyFloat_AsDouble also makes use of __index__, it'll call that, too.

My other thought was putting this in math, since it's what the math module is already doing implicitly to most inputs.

An alternative float constructor could work. Though we then run into the messy question of what it should do for float subclasses ...
History
Date User Action Args
2020-05-28 16:44:03mark.dickinsonsetrecipients: + mark.dickinson, zach.ware, serhiy.storchaka
2020-05-28 16:44:03mark.dickinsonsetmessageid: <1590684243.81.0.218288133784.issue40801@roundup.psfhosted.org>
2020-05-28 16:44:03mark.dickinsonlinkissue40801 messages
2020-05-28 16:44:03mark.dickinsoncreate