here a and b should be python list. Why not loop over all elements and call subtype.values_eq(a[i], b[i]) on them. That way we will call the good logic for all types.