Punishment increases stress. When a dog is stressed (like any animal or human) the ability to concentrate goes down and any learning will happen slower. Or, more likely the dog will learn wrong things! It will learn not to trust and to be afraid. Dogs are likely to associate the punishment with something else that is happening at the same time as the punishment, for example children or another dog passing by.
That way the problem will be bigger next time there are children or other dogs close by. When dogs are taught with positive methods they are very trusting towards the owner, which leads to being able to be relaxed and open to always learning new things! In training as such, dogs trained with positive methods learn FASTER and BETTER. And there is no limit to what they can learn.