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

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.

主站蜘蛛池模板: 宁德市| 昌黎县| 阳东县| 红安县| 苏州市| 北京市| 陆丰市| 太康县| 江孜县| 利川市| 八宿县| 九江县| 河池市| 津市市| 武城县| 山西省| 无棣县| 高清| 黄骅市| 晋宁县| 磐石市| 太谷县| 青神县| 乃东县| 上思县| 吴忠市| 彩票| 蒙阴县| 唐河县| 昭平县| 井陉县| 彭州市| 客服| 浙江省| 南通市| 平武县| 龙游县| 商水县| 招远市| 德保县| 随州市|