My kids are six and four, and explaining to them that something could seriously injure or kill them is definitely enough to prevent them from ever doing it. I can't imagine spanking them to try to make a point, but if anything I expect that would influence them to trust my warnings of potential injury less.