代码拉取完成,页面将自动刷新
"""Identity operators
@see: https://www.w3schools.com/python/python_operators.asp
Identity operators are used to compare the objects, not if they are equal, but if they are actually
the same object, with the same memory location.
"""
def test_identity_operators():
"""Identity operators"""
# Let's illustrate identity operators based on the following lists.
first_fruits_list = ["apple", "banana"]
second_fruits_list = ["apple", "banana"]
third_fruits_list = first_fruits_list
# is
# Returns true if both variables are the same object.
# Example:
# first_fruits_list and third_fruits_list are the same objects.
assert first_fruits_list is third_fruits_list
# is not
# Returns true if both variables are not the same object.
# Example:
# first_fruits_list and second_fruits_list are not the same objects, even if they have
# the same content
assert first_fruits_list is not second_fruits_list
# To demonstrate the difference between "is" and "==": this comparison returns True because
# first_fruits_list is equal to second_fruits_list.
assert first_fruits_list == second_fruits_list
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。