On 2013-06-14 18:01, Nick the Gr33k wrote:
On 14/6/2013 7:47 μμ, Benjamin Kaplan wrote:
  In an "and" clause,
python returns the first false value or the last value, because that
will evaluate to the correct Boolean value. In an "or" clause, python
returns the first true value or the last value. When Python finally got
a Boolean type, no one wanted to break backwards compatibility for this.


This is exactly what i dont understand and thats why i keep asking and people
call me an idiot. I just dont understand why it behaves like that.

Why return first or last value?

because that will evaluate to the correct Boolean value ????

How do you mean? Please elaborate.

Please read the link I gave. It explains why.

  http://docs.python.org/2/reference/expressions.html#boolean-operations

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to