Couldn't you just do the following? It would have the advantage to process everything in somehow a "vector" way, so you wouldn't have to loop over features..
1. Intersect both feature classes (e.g. paths, shortestPaths), keeping the attributes of both.
2. In the intersection feature class, discard entries with non-matching IDs (e.g. FID_paths, FID_shortestPaths), or create a new one or a layer, selecting only features with matching IDs (e.g. Make Feature Layer with SQL: "FID_paths" = "FID_shortestPaths").
3. In the resulting feature class or layer, dissolve based on one ID field (e.g. one of FID_paths, FID_shortestPaths, which are equal).
4. Get the Shape_Length field from the output of the dissolve tool.
Best regards,
Cedric