class SimpleLoc:
def __add__(self, other):
return CompoundLoc()
def __repr__(self):
return 'SimpleLoc'
class CompoundLoc:
def __add__(self, other):
return CompoundLoc()
def __repr__(self):
return 'CompoundLoc'
s = sum( [SimpleLoc(), SimpleLoc(), SimpleLoc()], CompoundLoc() )
print s
Y2xhc3MgU2ltcGxlTG9jOgogICAgZGVmIF9fYWRkX18oc2VsZiwgb3RoZXIpOgogICAgICAgIHJldHVybiBDb21wb3VuZExvYygpCiAgICBkZWYgX19yZXByX18oc2VsZik6CiAgICAgICAgcmV0dXJuICdTaW1wbGVMb2MnCgpjbGFzcyBDb21wb3VuZExvYzoKICAgIGRlZiBfX2FkZF9fKHNlbGYsIG90aGVyKToKICAgICAgICByZXR1cm4gQ29tcG91bmRMb2MoKQogICAgZGVmIF9fcmVwcl9fKHNlbGYpOgogICAgICAgIHJldHVybiAnQ29tcG91bmRMb2MnCgpzID0gc3VtKCBbU2ltcGxlTG9jKCksIFNpbXBsZUxvYygpLCBTaW1wbGVMb2MoKV0sIENvbXBvdW5kTG9jKCkgKQpwcmludCBz