Some pools / payout mechanisms are vulnerable to pool hopping.
Is P2Pool vulnerable?
From the Wiki on P2Pool:
Each share contains a generation transaction that pays out to the previous n shares, where n is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 17280, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve - proportional to the p2pool difficulty at that time.
So it works like a PPLNS pool, which is not vulnerable to pool hopping.