It's a combination of practice and using all four fingers in a given spot. I assume you are talking about the left/fretting hand.
1)The four finger per fret rule is very key. All four of your fingers should be ready to fret a note. If a bassline is around the same area than this method works great. (ie some classical, jazz melodies)
2) The thumbshift method is important. Your thumb should be able to make long shifts without loosing balance. This is good for using just one finger (doesn't matter which one) or to get to the higher notes quickly.
(ie the Killers "Mr. Brightside")
3) The upright approach is great for me. This is more of a 3 finger per fret rule in which a root 5th and octave are played with the index, middle, and pinky are only used. This is great for funk, sliding high notes, or fast rakes. Root,5ths, and octaves are in almost every bassline. (Kem "Inside", Motown, Led Zeppelin, Walking bass, anything with a lot of Roots 5ths octaves)
All of the methods above aren't rules. They are just good for certain situations. It's up to you in a given song to decide which is best.
This website helped me out a couple of years ago.
http://www.adamnitti.com/bass_player_03.shtml http://www.adamnitti.com/lessons.shtml