Can I post a new improved answer, based on another one under the same question(with a reference to the original answer) with the only difference, that the code snippet, which solves some common problem mentioned in the question is converted to a standalone convenient function?
Consider this example of such a question: How to check if a directory exists and create it if necessary?
What if the only answer was this solution:
try:
os.makedirs(path)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
then would it be acceptable to post a new answer with this code:
def make_sure_path_exists(path):
try:
os.makedirs(path)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise