In short....that is what the field calculator does... it provides the framework to loop through the rows and apply a function, which is also why it works on selections leaving the unselected untouched. This would require a separate bit of code in itself to work with selections. It does have its drawbacks, like having to use globals to keep track of what has gone on in the previous row (ie a previous value).
Sometimes the field calculator is just faster for simple things. It only gets difficult when people try to push the envelop and get it to do things for which it wasn't designed.