Eval of expr with 'or' and 'and' within

Nick the Gr33k support at superhost.gr
Fri Jun 14 13:01:23 EDT 2013


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.

-- 
What is now proved was at first only imagined!



More information about the Python-list mailing list