title: Python - Class instance list attribute changes other instances list attribute when appended
body: <p>I am new to Python so this might be a very dull question, though I have searched a lot on the subject and could not find an answer.</p>
  
  <p>So I am trying to code a simple "card game", and for that defined a class "Player", containing the list attribute "cards". I have made sure this attribute is within "def <strong>init</strong>" so that it is specific to the class instance, however when I append an element to this list for a Player A, it also appends it for Player B.
  Note: my code also includes a class "Deck" and "Card" that I do not explicitate here to keep it light)</p>
  
  <pre><code>class Player(object): #defines Player class, including its score and name
      all_players=[]
      def __init__(self,score,name,cards=[]):
          self.score=score
          self.name=name
          self.cards=cards
          Player.all_players.append(name)
  
  playera=Player(0,'John')
  playerb=Player(0,'Bill')
  playera.cards.append(Deck.hidden_cards[0])
  </code></pre>
  
  <p>==> playera.show_cards() and playerb.show_cards() then print the same results</p>
  
  <p>If someone could help me on that it would be much appreciated !
  Thanks in advance.</p>