Definitely depends on task - but maybe it depends on the personality of the child too?
Mine is spoiled (for want of a much less negative word) by having had round the clock parental attention (always one, sometimes both) and entertainment since she was born (now just over 3). She can keep herself engaged in an activity, but has a constant need to be watched, adored, acknowledged...and if bored, outrightly entertained.
I work from home, and it's been impossible to do with her around at all thus far. I think in the last six months I've gotten her to play in my 'office' whilst I worked for maybe an hour or so, maybe half a dozen times (?)...but she needs constant conversation during that to encourage her to keep going - and music blaring from my computer, all of which is zero-conducive to concentrating and getting things done properly. In fact, I make mistakes when I try to work like this. Not good.
Our only solution thus far, since she is not in daycare or preschool (preschool soon maybe...out of desperation...?) is my partner takes her out of the house for 2.5 hours most mornings. Then...if I'm lucky and she'll sleep at 'nap' time (all these inverted commas, because nothing is quite how it should be - naps are nearly no longer unfortunately) then I get another hour and a half. LUCKILY, my job is such I can get nearly a full days work done if I have 3-4 hours a day - the trouble is, this is not what it's like 50% of days.
I wish I knew the trick of getting them to occupy themselves - or rather....when does it start to kick in, age-wise?? OR...is mine just a bit 'spoiled' already by having a full time audience and circus troupe at the ready?
Oh - and for household type things, I just try and keep up my chatter so she feels engaged with me...but also run around her doing things that need doing. I will stop and focus on her if I can sense she's about to melt down. Occasionally I try and get her involved, but she seems to be at a stage where she just makes a complete mess of anything I'm trying to sort/tidy/do....ummm...deliberately too.
E.g. We've just moved house...would love it if she could help me sort and unpack boxes. No chance. The contents of EVERYTHING just gets wildly scattered around the house....until the place resembles a bomb site. Can't get her to help pick it up. Nothing.
Hmm. It is all rather frustrating now that I'm dwelling on it. And writing it out - maybe we have a discipline problem or two...?
Great question though!