Python `None` passed into type-conversion functions
问题 What is the rationale for the design decision for None type being passed into type-conversion functions? bool(None) returns False - which makes perfect sense str(None) returns 'None' which is not okay - Returning an empty string would be a better choice as below >>> bool(None) False >>> bool(str(None)) #Returning empty string will make it consistent by returning False True >>> bool('') False And list(None) , dict(None) , tuple(None) , int(None) , float(None) return Type errors - From which if