@Pitter,
Because most sites use cookies to 'enhance your browsing pleasure'.
It's not much of a stretch for Yahoo or whoever to search for a google cookie to extract your id from it.
If you're really keen you could always use incognito windows (after flushing cache and cookies) when access your gmail account.
I've got to the stage where I actually use different browsers for different identities. So Chrome for anonymous me, Firefox for work me, Safari for personal me. Gets confusing having multiple twitter, facebook and google accounts as well. - Grabinbox helped a bit with that.