Psychologists are in agreement that punishment does more harm than good.
Thousands of studies and years of practice show what punishment does teach - fear aggression and avoidance. People who are punished do not quickly learn to stop a behavior - what they quickly learn is next time don't get caught, or let's just avoid the whole situation if at all possible. Everyone knows if your number one goal is to change a behavior, punishment would be the last thing you'd choose. However, in situations where punishment is used, changing the behavior is not usually our number one goal - taking care of some uncomfortable or unpleasant emotion generally is. We punish in anger.