[Python] Compare if two variables reference the same object in python

Discussão em 'Python' iniciado por Stack, Fevereiro 26, 2025.

  1. Stack

    Stack Membro Participativo

    How to check whether two variables reference the same object?

    x = ['a', 'b', 'c']
    y = x # x and y reference the same object
    z = ['a', 'b', 'c'] # x and z reference different objects

    Continue reading...

Compartilhe esta Página