40 """Replace one object with a different one of the same type. 42 This function replaces the contents of `fromObj` object with those of `toObj`, 43 so all references ot it remain valid. 46 if type(toObj) != type(fromObj):
47 raise TypeError(
'replaceWith requires both arguments to be the same type')
49 if isinstance(toObj, cms._ModuleSequenceType):
50 fromObj._seq = toObj._seq
52 elif isinstance(toObj, cms._Parameterizable):
54 for p
in fromObj.parameterNames_():
56 for p
in toObj.parameterNames_():
57 setattr(fromObj, p, getattr(toObj, p))
58 if isinstance(toObj, cms._TypedParameterizable):
59 fromObj._TypedParameterizable__type = toObj._TypedParameterizable__type
62 raise TypeError(
'replaceWith does not work with "%s" objects' %
str(type(fromObj)))
64 def replace_with(fromObj, toObj)