When I was a kid one of the other neighborhood kids told me that if a dog play bites you, you are supposed to whack it on the nose so it wouldn't do it in the future. This is what is formally known as "Positive Punishment." (Positive means the addition of something.) Technically this method can be effective in getting your dog to stop biting you. But is it the best way? Are there side effects involved? To answer those questions, No, it is not the best way, and Yes, there are side effects involved.
The reason why this isn't the best way, and why they're are side effects involved is because it involves pain and fear. The reason why it would work is because you caused enough pain to make your dog not want to have that consequence happen again. But if you do that, there is a very good chance your dog will start to be weary of hands. Being weary of hands can be a recipe for disaster. He may never bite the person that is actually administering the punishment, and that would be because he is afraid of the person. But that doesn't mean he won't bite someone else. What happens when another person or even a child walks up and sticks their hand out to pet the dog on the head? There is a good chance that the dog could be afraid because he is used to being smacked in the face which could result in a bite due to fear. Probably what would follow the bite to another person would be the owner smacking the dog even harder for what it just did. With this happening the dog will be even more fearful of people. Instead of just wondering if the person is going to hit him, now he has to worry about getting hit really hard by the owner when other people approach...
What is the appropriate thing to do?
Well, I recommend taking away what the dog wants for starters. That would be you. Taking yourself away means you can ignore the dog completely, or you can put the dog away for a couple minutes. (A time out.) These are two ways to punish the unwanted behavior. Also we can teach an incompatible behavior which I explain in the video below. Check it out!