Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python == is deep
In [4]: l = [{'x': [254, 247, 230, 225, 222, 221, 231, 247, 281, 314, 381, 461, 487, 508, 517
...: , 504, 460, 431, 380, 346, 318, 301, 305, 309, 328, 359, 400, 413, 438, 441, 447, 472
...: , 490, 511, 519, 529, 529], 'y': [26, 25, 26, 28, 32, 37, 51, 58, 59, 56, 44, 34, 34,
...: 34, 35, 46, 60, 66, 75, 83, 91, 99, 101, 102, 105, 105, 105, 106, 110, 113, 116, 116
...: , 116, 116, 116, 112, 107]}, {'x': [479], 'y': [123]}, {'x': [20, 24, 27, 34, 45, 48,
...: 51, 59, 67, 71, 76, 80, 97, 108], 'y': [46, 48, 51, 58, 69, 72, 75, 82, 86, 87, 88,
...: 89, 93, 96]}, {'x': [619, 619, 620, 620, 620, 620], 'y': [29, 37, 41, 50, 55, 64]}]
...:
In [5]: l2 = [{'x': [254, 247, 230, 225, 222, 221, 231, 247, 281, 314, 381, 461, 487, 508, 51
...: 7, 504, 460, 431, 380, 346, 318, 301, 305, 309, 328, 359, 400, 413, 438, 441, 447, 47
...: 2, 490, 511, 519, 529, 529], 'y': [26, 25, 26, 28, 32, 37, 51, 58, 59, 56, 44, 34, 34
...: , 34, 35, 46, 60, 66, 75, 83, 91, 99, 101, 102, 105, 105, 105, 106, 110, 113, 116, 11
...: 6, 116, 116, 116, 112, 107]}, {'x': [479], 'y': [123]}, {'x': [20, 24, 27, 34, 45, 48
...: , 51, 59, 67, 71, 76, 80, 97, 108], 'y': [46, 48, 51, 58, 69, 72, 75, 82, 86, 87, 88,
...: 89, 93, 96]}, {'x': [619, 619, 620, 620, 620, 620], 'y': [29, 37, 41, 50, 55, 64]}]
...:
In [6]: len(l)
Out[6]: 4
In [7]: len(l2)
Out[7]: 4
In [8]: l.append('test')
In [9]: l[-1]
Out[9]: 'test'
In [10]: l2[-1]
Out[10]: {'x': [619, 619, 620, 620, 620, 620], 'y': [29, 37, 41, 50, 55, 64]}
In [11]: l = l[:-1]
In [12]: l[-1]
Out[12]: {'x': [619, 619, 620, 620, 620, 620], 'y': [29, 37, 41, 50, 55, 64]}
In [13]: l == l2
Out[13]: True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment