On Sun, Sep 30, 2012 at 2:51 PM, Joshua Landau <joshua.landau.ws@gmail.com> wrote:
On 30 September 2012 22:48, Joshua Landau <joshua.landau.ws@gmail.com> wrote:
This seems like a problem for the proposal, though: we can't have it in the math library if it's a method!
Now I think about it: yeah, it can be. We just coerce to float/decimal first. *sigh* math.ceil(x), math.floor(x), and math.trunc(x) and round(x) already call the special methods x.__ceil__, x.__floor__, x.__round__, and x.__trunc__. So those four functions already work with decimal instances (and other numeric types that support those methods.)
casevh
_______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas