Ticket #61 (new defect)

Opened 2 years ago

Error in discussion of short-circuit evaluation

Reported by: gvwilson Assigned to: gvwilson
Priority: major Milestone: Someday
Component: lectures Version:
Keywords: Cc:

Description

swc::Short-Circuit Evaluation:1134

++++ Error 1 ++++

---> swc::Short-Circuit Evaluation:1134

The result of expression

cond and left or right

depends on the "truth value" of variable 'left':

If 'cond' is True and the truth value of 'left' is False, then the result of the expression is equal to the value of 'right'

def f(cond, left, right):

... return cond and left or right ...

f(True, "A", "B")

'A'

f(False, "A", "B")

'B'

f(True, 0, "B")

'B'

f(False, 0, "B")

'B'

f(True, "", "B")

'B'

f(False, "", "B")

'B'

f(True, None, "B")

'B'

f(False, None, "B")

'B'

++++ Error 2 ++++

The hyperlinks "More on Objects" do not work ---> swc::Execution Cycle:1134 ---> swc::Function Attributes:1124