Cleanup + micro-optimizations for merge_with

This replaces some PyList* calls by a list comprehension, which is cleaner and marginally faster.