no sign() function ?

ajaksu ajaksu at gmail.com
Wed Dec 24 10:57:40 EST 2008


On Dec 24, 5:59 am, pdora... at pas-de-pub-merci.mac.com (Pierre-Alain
Dorange) wrote:
>
> For me sign_0 is the simplest one to understood.
> So in the domain of my little arcade game, this is what i'll use.
> I don't need the accuraccy of sign_1, because in the application i just
> need to know if the target is right or left or if the speed direction is
> right or left.

If there is a chance of getting bogus input to sign_0 (like a list,
None or other non-numeric types) it might be worth to add a quick
check like:

def sign_0(x):
    x + 0
    if x==0.0:
    ...



More information about the Python-list mailing list