Practical defense against weapons
First off, I do not advocate trying to defend yourself against a gun or knife at the drop of a hat. If someone brandishing a weapon at you advises you to relinquish your money, do so. If they want your keys, even better. Report the car stolen later. It is not worth your life.
If you are in a situation where you know for sure you are going to be raped/killed, by all means try to defend yourself. However, there are ways to go about it that are wiser than others.
If faced with a knife, the defender must first come to the full on realization that you will be injured. Coming off scott free is for movies. If you expect it, you will not panic when it happens.
The main idea of knife defense is to keep the knife as far away from you as possible. When blocking and moving into a grab for a possible takedown, keep your arms at full length, if possible. Always complete a block before any kind of grab is attempted. Trying to catch a knife has a despairingly low chance of succeeding. Blocking the arm swinging the knife is more likely to come off successfully. The second priority is to get away. Run. If this is not an option, move onto disarming your opponent. If you succeed in removing the knife from the attacker's grasp, do not turn it back on him. The situation has gone far enough and the excuse of self-defense will not cover you past the point of initial danger. If there are multiple attackers with intent to kill, this is another story. Use a debilitating but non-lethal technique like cutting the Achilles' tendon or slicing the thigh.
A gun defense is a whole new ball game. The idea behind a gun defense (besides being very inadvisable) is to keep it as close as possible. The closer your body is to the gun, most likely a pistol, the easier it will be to avoid its discharge. The main purpose of a gun is a distance weapon, therefore the opponent will want you as far as possible to have a chance to aim and fire. If the element of surprise is achieved, one can remove the gun from the attacker through means of a well placed strike or kick to the gun hand. A punch or palm heel to the back of the hand or wrist numbs the hand temporarily, enough to force the attacker to drop the gun.