I&C SCI 33 Lecture Notes - Lecture 8: Init, Relational Operator, Operand
Document Summary
__bool__ function on that object to determine whether its boolean equivalent represents true or false. If __bool__ is not defined, python returns len(object) != 0. If there is no __len__, then python just returns true. Interlude: short-circuit logical operators and their real meanings. The operators and/or are called short-circuit operators. This means that they evaluate the left-hand side first, but don"t always evaluate the right-hand side. For example: if x and y: