So, if the above rule is worthless, then how do you go about stocking a tank? There's no one factor in stocking a tank. If there were a formula that you could follow, there would be one (and it would involve more variables than just fish length and water volume.) Tanks are usually stocked on a case-by-case basis by someone with experience.
===========================================
Here's a few things to consider:
===========================================
1. Bio load -- the more fish you have, the lower the water quality will be. Put one fish in 100 gallons and the water will stay fairly clean. Put 1000 fish in 100 gallons and the water will become polluted very quickly. Obviously, you're ultimately limited by the water volume, and filtration capacity (plants and bacteria.)
2. Swimming room -- if the fish doesn't have enough room to swim, it's a problem. Don't put a 10" fish in a 10 gallon tank because it can barely turn around.
3. Fish density -- # of fish per gallon of water. If you have 100 fish in a 100 gallon tank, each effectively has 1 gallon to itself. Some fish might be able to tolerate that, while others can't. If you've ever gone to a pet store and seen hundreds of goldfish crammed into a feeder tank, this is a good example. Sure, the filtration might be adequate, but there's so many fish that they can't swim end to end without hitting each other.
4. Aggression -- fish which get along in a spacious home might not be so kind to each other in cramped quarters. Giving fish infinite space doesn't mean they won't harass each other, but the less meetings they have, the better they'll be.
===========================================
So how do you apply these considerations to a real tank?
===========================================
As an example, I'll use my tank:
(Pictures here)Tank:
10 gallons
moderately planted
aquascaping in the form of some rocks
Fish:
2x Honey dwarf gourami
3x Glo-lite tetra
3x Neon tetra
Evaluating my tank:
1. Bio load -- none of these fish really break the bank in terms of ammonia or acid production. The plants combined with the bacteria in my filter keep the water quality good between water changes.
2. Swimming room -- none of these fish have trouble fitting within a 10 gallon tank. While I do have plants and rocks in the tank, the fish don't have trouble swimming around them. If I wanted to have a massive school of tetras, there might be problems because of the amount of room that plants occupy.
3. Fish density -- 0.8 fish per gallon, so each fish would otherwise have a gallon of room to itself. The total number of fish is eight, and they don't have trouble moving around without bumping into one another.
4. Aggression -- none of these fish are aggressive. Larger gouramis yes, but the small ones I have could care less than they do about my other fish (which is not at all.)
===========================================
Conclusion
===========================================
If I wanted to, put two more tetras into the tank and not exceed my filtration capacity, or break the quantity or swimming room limitations.
As you can see there's much more to this than simply applying an arbitrary rule. I understand that people create "rules of thumb" for those who are less experienced. There is logic to stocking a tank but it's very difficult to describe, and to an inexperienced person looks just as arbitrary as "one inch of fish per gallon."