Yesterday on Do Some Damage, Steve Weddle asked whether characters have to be moral/have morals.
I don't think anyone, real or fictional, can live by a man-made code (as opposed to genetic predisposition). All man-made codes get broken now and then, so why define them? I prefer to find out about a character as I read, by the way he reacts to what's thrown in his path. Characters/people can say (or codify) whatever they want. What they do when the chips are down defines them.
If a character is around for enough stories or books, his range of behavior gets defined anyway. No person will take any conceivable action anytime. A specific person is limited to a set of actions based on what he wants or values most in life. The trick for writers is to make each situation feel new so audiences can't be sure exactly what characters will do in response.
I do want to believe in heroes, but an act is most heroic when one doesn't have a code dictating action. In the thick of things, people often don't reason out the consequences. They just act based on everything they've been taught or experienced, and what happens happens.
You may have heard how Mark Harmon saved two people from a burning car near his house some years ago. Harmon said his wife, Pam Dawber, called for help and he just reacted. He has said if the car had exploded and he died, the story would have been about how he rushed in with little thought and get himself killed.