Some people actually value life and don't want "Kill a motherfuger with my gun" to be the answer to everything.
Who said anything about necessarily killing anyone? If someone with a hammer came at you, and you pull out a gun, it might make them think twice about what they do next. If pulling out a gun doesnt phase them, and they decide to move forward with their intent to kill you, you could always immobilize them with a shot to the arm or leg or something. However at the same time...considering what the attacker is trying to do unto you, makes it reasonable for you to use whatever extent of force is necessary to prevent their actions if it gets to that point.
This is not a matter of weapons. It is a matter of intentions.