title: How to save a python object whose attributes also are objects and that on multiple levels?
body: <p><strong>Hello, i have made a chess game in Python using pygame.</strong></p>
  
  <p>To do so, i have made an object of a "chess game" class i also made.
  Now i would like to save games so we can play chess later.</p>
  
  <p>I know that can use pickle (or other modules like json, and hdf5) to save my games.
  I am aware that pickle can only let me save objects if i give their dictionnaries of variables in parameter for the pickle.dump method.</p>
  
  <p><strong>The problem is the following:</strong>
  How to save a python object whose attributes also are objects and that on multiple levels?</p>
  
  <p>To explain myself:
  I have made an object of my "Chess" class whose attributs contain other objects.</p>
  
  <p>For exemple, "board" is an attribut of chess and is an object of my "Board" class,
  and board also contains objects,
  one of which is the grid of all the pieces (it's a matrix made with a list in a list) and each of element of the grid is an object "piece" of my "Piece" class.</p>
  
  <p>So is there a simple way to save all my game attributs without having to decompose each objects to get their dictionnaries?
  and if yes, is it possible to save objects containing other objects as many times as i want?</p>
  
  <p>Thank you very much in advance! :D</p>