- Python Data Structures and Algorithms
- Benjamin Baka
- 130字
- 2021-07-09 19:45:01
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.
推薦閱讀
- Reporting with Visual Studio and Crystal Reports
- Docker技術入門與實戰(zhàn)(第3版)
- JavaScript 從入門到項目實踐(超值版)
- PostgreSQL 11從入門到精通(視頻教學版)
- Learning Neo4j 3.x(Second Edition)
- Learning Python Design Patterns
- 移動界面(Web/App)Photoshop UI設計十全大補
- iPhone應用開發(fā)從入門到精通
- 響應式Web設計:HTML5和CSS3實戰(zhàn)(第2版)
- Mastering Gephi Network Visualization
- Learning D
- React.js實戰(zhàn)
- 趣味掌控板編程
- jBPM6 Developer Guide
- 程序員超強大腦