Update shortpath.py

fixed minor redundancies