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

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.

主站蜘蛛池模板: 台北市| 开封市| 芜湖县| 随州市| 微山县| 山西省| 墨江| 通许县| 乌鲁木齐市| 手游| 米泉市| 长宁区| 泗水县| 钟山县| 伊金霍洛旗| 林芝县| 新沂市| 盐津县| 东港市| 瓮安县| 磴口县| 章丘市| 兰州市| 四平市| 诸城市| 酒泉市| 牙克石市| 凤阳县| 宣恩县| 濮阳县| 商丘市| 当涂县| 昌黎县| 枣强县| 北京市| 江安县| 醴陵市| 招远市| 洞头县| 亳州市| 荆州市|