mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-11 17:24:29 +02:00
Changed a to b in comment about list assignment, and pluralized 'variable'.
This commit is contained in:
@@ -97,13 +97,13 @@ False or True # => True
|
|||||||
1 < 2 < 3 # => True
|
1 < 2 < 3 # => True
|
||||||
2 < 3 < 2 # => False
|
2 < 3 < 2 # => False
|
||||||
|
|
||||||
# (is vs. ==) is checks if two variable refer to the same object, but == checks
|
# (is vs. ==) is checks if two variables refer to the same object, but == checks
|
||||||
# if the objects pointed to have the same values.
|
# if the objects pointed to have the same values.
|
||||||
a = [1, 2, 3, 4] # Point a at a new list, [1, 2, 3, 4]
|
a = [1, 2, 3, 4] # Point a at a new list, [1, 2, 3, 4]
|
||||||
b = a # Point b at what a is pointing to
|
b = a # Point b at what a is pointing to
|
||||||
b is a # => True, a and b refer to the same object
|
b is a # => True, a and b refer to the same object
|
||||||
b == a # => True, a's and b's objects are equal
|
b == a # => True, a's and b's objects are equal
|
||||||
b = [1, 2, 3, 4] # Point a at a new list, [1, 2, 3, 4]
|
b = [1, 2, 3, 4] # Point b at a new list, [1, 2, 3, 4]
|
||||||
b is a # => False, a and b do not refer to the same object
|
b is a # => False, a and b do not refer to the same object
|
||||||
b == a # => True, a's and b's objects are equal
|
b == a # => True, a's and b's objects are equal
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user