At least a bell sounds relatively polite if you're not spamming it. A horn is a bit aggressive, you have to modulate it.
In a car I use two short tapped toots as a polite kind of 'excuse me' e.g. if someone hasn't noticed a light turning green. That seems more friendly than a sustained blast.
On the bike with a bell I'll just say thank you as I pass, if they've moved for me. Usually seems to go down well enough.