fork download
  1. class SimpleLoc:
  2. def __add__(self, other):
  3. return CompoundLoc()
  4. def __repr__(self):
  5. return 'SimpleLoc'
  6.  
  7. class CompoundLoc:
  8. def __add__(self, other):
  9. return CompoundLoc()
  10. def __repr__(self):
  11. return 'CompoundLoc'
  12.  
  13. s = sum( [SimpleLoc(), SimpleLoc(), SimpleLoc()], CompoundLoc() )
  14. print s
Success #stdin #stdout 0.08s 10848KB
stdin
Standard input is empty
stdout
CompoundLoc