It truly depends on your situation. It can really hurt you at tax time to do something like this. The only way I'd advise it is if you know you're going to have extra room and can avoid paying so much of the penalty. I'll give you my real life example.
My husband quit his job last year to go back to school. He'd been working there for 7 years, so he was fully vested and had $9000 in his 401k. He took the payout. Right off the top, they took 20% of it, which they are allowed to do. 10% covers taxes, 10% is a penalty fee for early withdrawal. The tax portion, we mostly got back, because our combined income was $10,000, so even with the payout, we only "made" about $20,000 last year. I had a lot of dental bills (needed a lot of work, had no dental insurance), so I claimed ~$3,000 in medical expenses on my taxes.
This is where they double-dip to screw you over. Even though the $9,000 in 401k distribution was not earned income, it contributed to the amount we had made (our AGI). I had to get over a threshold that was 10% of my AGI, and anything over that, I could claim to reduce the early-withdrawal penalty. That left me with not very much. The government took about $1000 of the $9000 between leftover taxes and the withdrawal penalty. We also would have qualified for earned income credit of ~$400 had we not had that extra income from the 401k distribution. Even though it was not "earned", the government counted it and denied us the earned income credit.
It was very worth it for us because we still got about $7,500 of it in the end, and the extra $1,500 the government took was what my husband's company had vested him anyway. We gained money. Most people are not poor enough to benefit in that way, and even though we were, he still lost $9,000 toward retirement, and that's something we'll have to spend a lot of time making up for.
I never would have touched it had there been any other plausible way to send both of us to school, but there wasn't. Now I'm a nurse, and my annual salary is $45k. Putting off school to work a min wage job and save up for tuition would not have been worth the wasted time where I could have been earning a much higher salary. Your long run almost definitely looks different from mine, though. For most, it would never be worth it to withdraw from a retirement fund.