FunctionThatTakesABoolean: A Terrible Code Smell

Here at Terrible Coding Practices, we're proud to present to you the FunctionThatTakesABoolean: A code function that takes a boolean as input, but does it really do anything useful?

			def FunctionThatTakesABoolean(input: bool):
				if input == true:
					print("I'm so happy it's true!")
				elif input == false:
					print("I'm so sad it's false!")
				else:
					print("I'm confused, it's neither true nor false!")
				return None
		

As you can see, this function is a prime example of a code smell. It does nothing but print out a message based on the input, and it's not even clear what the purpose of this function is. We recommend avoiding such code in your production codebase.

Why is this code still in production?

Join our community of terrible coders and share your own code smell stories!