1) you are alone in your house/shower
2) you are attempting to summon a dog
3) you are attempting to hail a cab that has its windows down (if the windows aren't open, whistling is both futile and obnoxious)
4) you have just sang Rogers and Hammerstein's "I whistle a happy tune" and feel obliged to prove you aren't a liar
when it is NOT okay to demonstrate your shrill whistle:
1) at my library
2) at my library after I have already asked you politely to stop whistling.
3) at my library after I have already asked you, again, somewhat less politely, to stop whistling.
Really people, whistling is like farting: few people do it pleasantly, and most people have no idea the intensity of their outburst. If someone says your whistling is shrill, it probably is. They aren't just trying to crush your obvious joy, but rather asking if you might put away that portable chalkboard you cart around to scrape your fingernails against when you're out and about.
Also, as a result of #4, I have now just pictured a stereotypical show-tunes fan in voluminous pants saying, "Stop! Hammerstein! "