I read somewhere that functions should always return only one type so the following code is considered as bad code:
def x(foo): if \'bar\' in foo: return
I personally think it is perfectly fine for a function to return a tuple or None. However, a function should return at most 2 different types and the second one should be a None. A function should never return a string and list for example.