官术网_书友最值得收藏!

Boolean operations

A Boolean operation returns a value of either True or False. Boolean operations are ordered in priority, so if more than one Boolean operation occurs in an expression, the operation with the highest priority will occur first. The following table outlines the three Boolean operators in descending order of priority:

Both the and operator and the or operator use "short-circuiting" when evaluating an expression. This means Python will only evaluate an operator if it needs to. For example, if x is True then in an expression x or y, the y does not get evaluated since the expression is obviously True. In a similar way, in an expression x and y where x is False, the interpreter will simply evaluate x and return False, without evaluating y.

主站蜘蛛池模板: 天气| 丰城市| 永年县| 论坛| 象山县| 会理县| 临邑县| 花莲市| 房产| 翼城县| 保康县| 连云港市| 涞水县| 三亚市| 茌平县| 鱼台县| 哈巴河县| 牡丹江市| 夏津县| 宜州市| 奉化市| 信丰县| 镇宁| 鹤山市| 临沧市| 云林县| 宜丰县| 八宿县| 石河子市| 商水县| 麻江县| 宝应县| 梅州市| 罗源县| 闸北区| 凤冈县| 吉安市| 靖安县| 林口县| 阿拉善盟| 克什克腾旗|