Сквозные параметры (in-out)

Классы / Методы

class Swap:
    @staticmethod
    def strings(v1, v2):
        v1[0], v2[0] = v2[0], v1[0]


s1 = ["A"]
s2 = ["B"]
# Names can't be rebound: swap list items
Swap.strings(s1, s2)
# s1[0] is 'B', s2[0] is 'A'

print(f"{s1 = }")
print(f"{s2 = }")