- Python Data Structures and Algorithms
- Benjamin Baka
- 55字
- 2025-04-04 19:15:34
Membership, identity, and logical operations
Membership operators (in, not in) test for variables in sequences, such as lists or strings do what you would expect, x in y returns True if a variable x is found in y. The is operator compares object identity. For example, the following snippet shows contrast equivalence with object identity:
