Fix: variable `p` overrides previous definition

In Python 2.x, the loop variable from a list comprehension bleeds into the calling context, overriding local `p` in this case.