fork(3) download
  1. import pickle
  2.  
  3. class Car:
  4. def __init__(self, model, number):
  5. print('Calling Car', (model, number), sep='')
  6. self.model = model
  7. self.number = number
  8. def __reduce__(self):
  9. return (Car, (self.model, self.number))
  10.  
  11. pickle.loads(pickle.dumps(Car('T', 5), protocol=pickle.HIGHEST_PROTOCOL))
Success #stdin #stdout 0.05s 9780KB
stdin
Standard input is empty
stdout
Calling Car('T', 5)
Calling Car('T', 5)