1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Are Python sets mutable?

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

  1. Stack

    Stack Membro Participativo

    Are sets in Python mutable?


    In other words, if I do this:

    x = set([1, 2, 3])
    y = x

    y |= set([4, 5, 6])


    Are x and y still pointing to the same object, or was a new set created and assigned to y?

    Continue reading...

Compartilhe esta Página