This shouldn't be that surprising. Wild pythons and boas have been shown to re-use ambush sites that were previously successful, for example; some snakes that hibernate are known to return to previous den sites; I don't think we should be surprised that any vertebrate is able to learn from previous experiences, or even invertebrates. It's a pretty basic survival skill for any animal with a brain.
Plenty of animals turn out to be more trainable than you might think; I've heard of people teaching their bettas to swim through hoops or touch targets for food. The real difficulty with training snakes the same way is that it's hard to give food rewards to an animal that naturally eats large infrequent meals, and operant conditioning hinges on being able to reward the animal with something it really wants. So training a snake is hard because it's hard to tell what it wants in the moment if it's not food, and it's hard to give multiple food rewards to an animal that naturally eats one gigantic item and then doesn't eat again for a long time. But that is not the same as them not being smart enough to learn things.