Tag Archives: none

Python: str(None) should return ” not ‘None’

Think about the following code: x = some_function_that_might_return_none() if str(x): do_one_thing() else: do_another_thing() do you think do_another_thing() will ever execute? Did you know that str(None) is ‘None’ and thus: if str(None): this_willl_always_execute() I can see how you might want str(None) … Continue reading

Posted in General | Tagged , , | Leave a comment