if parrot == "dead": parrot.return_to_store()
Depending on the type of string you're testing, often you can do this:
if "dead" in parrot: parrot.return_to_store()This is powerful because when you want to test this function, you can pass it "dead.unittest" and it will succeed, exercising the code.
Naturally, use with caution as if the code shouldn't execute on "undead" you can't use this sort of idiom.
The more I think about it, the more I think this could be considered dangerous; good for some internal uses (e.g. unit tests) but there are tradeoffs; probably doesn't belong in a public facing API.
But I'm posting it anyway because, hey, maybe someone has input. (lol)