If this happens to be avoiding the thing being punished, it’s purely a matter of luck. They may also learn to say, hide their behavior from whoever’s punishing it, run away, etc.
Indeed, they will often learn all of these at once, and then the punisher must do extra work to negate the latter set. So, yeah, negative reinforcement typically works better than positive punishment in the long run. Negative punishment (that is, removing something good when I do something) can work OK too, though it has some of the same problems. Training an incompatible behavior via positive reinforcement is often faster, though sometimes not an option.
Indeed, they will often learn all of these at once, and then the punisher must do extra work to negate the latter set. So, yeah, negative reinforcement typically works better than positive punishment in the long run.
Negative punishment (that is, removing something good when I do something) can work OK too, though it has some of the same problems.
Training an incompatible behavior via positive reinforcement is often faster, though sometimes not an option.