Punishment is an external force for controlling parents. External forces are effective to a point. Children will obey when the external force or threat is present but revolt against it when the force is removed. So, when a parent leaves a room or children are not under their control, they often do what they want because no internal sense of right and wrong is present in children. Discipline uses internal and external force to teach right from wrong.
Parents use external force and model or guide children about right and wrong.
This way children will follow the rules when parents are not around to enforce the rules. Authoritarian parents tend to use spanking as a method of external force. This has been proven to be ineffective for the same reasons, namely, children will do what they are told to avoid getting a spanking but they will do what they want when no one is around to spank them. That is because they have not internalized right from wrong. Spanking is only one tool that parents can use.