[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] shapes other than rects?
>I could have avoided all the confusion just by saying
>'logical_and' which is the real name of the ufunc but
>I was just being lazy. It would have been better for
>clarity, especially since I also took advantage of how
>arrays get cast to regular Python bools which made it
>extra confusing.
>
Hello!
I appreciate your comments, but I think you get an good explanation of
what's going on to explain that behavior and result in the Python docs. Try
these URLs:
http://www.python.org/doc/current/ref/lambda.html
http://www.python.org/doc/current/lib/truth.html
Basically, AND and OR returns one of their arguments, the "true" or "false"
one. So what you get back is not a bitwise and/or but _your original array_.
Compare "print 7 and 8" with "print 7 & 8". This holds true for arrays as
well. In the AND case you back the first one as it's evaluated to FALSE
(overloaded truth value for all zeros). In the OR case you get back the
second one as the first one evaluates to FALSE.
No bitwise comparison. No comparisons whatsoever. Just logic.. I'm afraid.
I've learned a bit about Python though:)
-
Martin Sandin
come.to/vague
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org