I don't know if there's a best way to do it since it depends on your file and workflow but :
import bpy
m_source = bpy.data.materials["Material.001"]
m_target = bpy.data.materials["Material.002"]
for obj in (o for o in bpy.data.objects if hasattr(o, "material_slots")):
for slot in obj.material_slots:
if slot.material is None:
continue
if slot.material.name == m_source.name:
slot.material = m_target
There actually are material operators to copy/paste material settings but they require a handle on an active object with both materials so it might no be very convenient.