There are pythons and there are pythons. A lot depends on the species.
Like most reptiles, the amount of real thinking that goes on in their reactions is limited. They pretty much are programmed to do certain things - they react instinctively.
Rock Pythons are bad news. Burmese have better temperaments, but they grow too large.