OT: Taking a loan from 401(k)

Is it a good idea to take out a loan from your 401(k) plan for the purchase of a primary residence? I like the idea that you pay interest back to yourself. However, one of the biggest drawbacks is that you may not be able to contribute to the plan while you have an outstanding loan (depending on your plan.) So, is it worth taking out a loan from your 401(k)