Message370244
> `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 ... |
|
Date |
User |
Action |
Args |
2020-05-28 16:44:03 | mark.dickinson | set | recipients:
+ mark.dickinson, zach.ware, serhiy.storchaka |
2020-05-28 16:44:03 | mark.dickinson | set | messageid: <1590684243.81.0.218288133784.issue40801@roundup.psfhosted.org> |
2020-05-28 16:44:03 | mark.dickinson | link | issue40801 messages |
2020-05-28 16:44:03 | mark.dickinson | create | |
|