This quote originated and William Shakespeare's history play Henry IV Part 1. It originally appeared as "the better part of valor is discretion" but is usually rearranged to fit more smoothly with everyday speech.