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

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.

主站蜘蛛池模板: 海城市| 遂昌县| 兴文县| 平湖市| 桑植县| 洛阳市| 武夷山市| 巫溪县| 道孚县| 郸城县| 望江县| 通化县| 盘锦市| 布尔津县| 雅江县| 金山区| 平度市| 淳安县| 库伦旗| 平果县| 舒兰市| 千阳县| 兖州市| 花莲市| 桓台县| 东乡族自治县| 嘉黎县| 沙河市| 昆山市| 竹山县| 疏勒县| 岑巩县| 定日县| 台南市| 石楼县| 盘山县| 东阳市| 郑州市| 会昌县| 泰和县| 抚松县|