[Python] What's the difference between is and == in Python?

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

  1. Stack

    Stack Membro Participativo

    I'm a bit confused about the difference between is and == in Python.

    For example:

    a = [1, 2, 3]
    b = a
    c = [1, 2, 3]

    print(a == b) # True
    print(a is b) # True

    print(a == c) # True
    print(a is c) # False

    Continue reading...

Compartilhe esta Página