57 """Replace one object with a different one of the same type. 59 This function replaces the contents of `fromObj` object with those of `toObj`, 60 so all references ot it remain valid. 63 if not isinstance(toObj, type(fromObj)):
64 raise TypeError(
'replaceWith requires both arguments to be the same type')
66 if isinstance(toObj, cms._ModuleSequenceType):
67 fromObj._seq = toObj._seq
69 elif isinstance(toObj, cms._Parameterizable):
71 for p
in fromObj.parameterNames_():
73 for p
in toObj.parameterNames_():
74 setattr(fromObj, p, getattr(toObj, p))
75 if isinstance(toObj, cms._TypedParameterizable):
76 fromObj._TypedParameterizable__type = toObj._TypedParameterizable__type
79 raise TypeError(
'replaceWith does not work with "%s" objects' %
str(type(fromObj)))
81 def replace_with(fromObj, toObj)