<div dir="ltr"><div class="gmail_quote">On Mon, Apr 26, 2010 at 11:16 PM, Xavier Ho <span dir="ltr"><<a href="mailto:contact@xavierho.com">contact@xavierho.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="im">On Tue, Apr 27, 2010 at 7:12 AM, cool-RR <span dir="ltr"><<a href="mailto:cool-rr@cool-rr.com" target="_blank">cool-rr@cool-rr.com</a>></span> wrote:<br></div><div class="gmail_quote"><div class="im">
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">

<div dir="ltr">This was probably discussed a lot. Why is there no simple `sign` function in Python, like in the math module or something? I mean one that tells you the sign of a number.<div><br></div></div></blockquote></div>
<div>

<br>I really hate to shot you down man. First of all, how are you returning the sign? True/False for positive or negative? What about zero? Is zero a positive or a negative number?<br><br>Secondly, when you get the output, how are you using it? Comparison -- ah wait, there is always <span style="font-family:courier new,monospace">if x > 0</span> ... <br>


<br>I think you need to carefully think about these ideas before proposing them. I feel you're wasting your own time, here.<br><br>Cheers,<br>Xav<br></div></div>
</blockquote></div><div><br></div>Hey Xavier,<div><br></div><div>I don't feel I'm wasting my time. If you feel I'm wasting yours you are free to ignore my messages.</div><div><br></div><div>I return 1 for positive, 0 for zero, -1 for negative. Yes, I know I can improvise something like it, by using `x > 0` or `cmp(x, 0)`, but I like code that reads like what it does.</div>
<div><br></div><div>Ram.</div><div><br clear="all"><br>-- <br>Sincerely,<br>Ram Rachum<br>
</div></div>