On 2008-12-22, Pierre-Alain Dorange wrote:
> def sign(x):
>     if x==0.0:
>         return 0.0
>     elif x>0.0:
>         return 1.0
>     else:
>         return -1.0

Isn't this approximately this? ::

    def sign(x):
        return float(cmp(x, 0))

Or if you don't want a float response::

    def sign(x):
        return cmp(x, 0)

-- 
Regards,
Stephen Thorne
Development Engineer
NetBox Blue - 1300 737 060
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to