if you can articulate in a proper manner as to why you had to use self defense to shoot and kill the attacker, NO you do not get punished... it is our right to defend our family and ourselves with any means necessary.
Also if guns are legal, its going to be easier for the person attacking you to have a gun also. Then what? First to go down loses?