What's the best way to write a null-check in Python? Try-Except blocks, if blocks...?
Given a function that returns None if the input is None, a valid input, what's the best approach to deal with this situation? Take this function for example:
def urlify(path):
if path is None:
return None
return "<a href=\"{0!s}\">{0!s}</a>".format(path)
return path and "<a href=\"{0!s}\">{0!s}</a>".format(path)str.format()to generate HTML instead of a proper sanitizing template engine. Too many security holes to leave open.