<br><br><div class="gmail_quote">On 30 September 2012 23:08, Case Van Horsen <span dir="ltr"><<a href="mailto:casevh@gmail.com" target="_blank">casevh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">On Sun, Sep 30, 2012 at 2:51 PM, Joshua Landau<br>
<<a href="mailto:joshua.landau.ws@gmail.com">joshua.landau.ws@gmail.com</a>> wrote:<br>
> On 30 September 2012 22:48, Joshua Landau <<a href="mailto:joshua.landau.ws@gmail.com">joshua.landau.ws@gmail.com</a>><br>
> wrote:<br>
>><br>
>> This seems like a problem for the proposal, though: we can't have it in<br>
>> the math library if it's a method!<br>
><br>
><br>
> Now I think about it: yeah, it can be. We just coerce to float/decimal<br>
> first. *sigh*<br>
</div></div>math.ceil(x), math.floor(x), and math.trunc(x) and round(x) already<br>
call the special methods x.__ceil__, x.__floor__, x.__round__, and<br>
x.__trunc__. So those four functions already work with decimal<br>
instances (and other numeric types that support those methods.)<br></blockquote><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

 >>> math.ceil("")<br>Traceback (most recent call last):<br>  File "<stdin>", line 1, in <module><br>TypeError: <b>a float is required</b></blockquote><div><br></div><div>How deceptive... I hope you forgive me for not realizing that (even though I must have seen the __ceil__ and __floor__ methods a thousand times).</div>

<div>OK, carry on.</div></div>