>>> class M:
data = []
def __init__(self, value):
self.value = value
>>> x = M(1)
>>> y = M(2)
>>> x.value
1
>>> y.value
2
>>> x.data
[]
>>> y.data
[]
>>> x.data.append(10)
>>> x.data
[10]
>>> y.data
[10]
>>> x.value += 10
>>> x.value
11
>>> y.value
2
list1 = [x for x in range(1, 20000)]
list2 = [x for x in range(1, 10000)]
set.difference(set(list1), set(list2))
rows = [
[1, 3, 4],
[1, 2, 3, 5, 6],
[1, 3, 5],
[1, 3, 11]
]
res = set(rows[0])
for row in rows[1:]:
res.intersection_update(row)
>>> compound_transpositions = [[2, 3], [3, 4], [4, 5], [5, 6]]
>>> coefficients = [17, 69, 84, 3, 46, 97, 12, 68, 70, 10]
>>> compound_transpositions.sort(key=lambda x: coefficients[x[0]]-coefficients[x[1]])
>>> compound_transpositions
[[4, 5], [3, 4], [2, 3], [5, 6]]