Command Query Separation is a useful principle, though it's not always ideal. Sometimes you need to run a process, which will result in useful data you need to return. My specific case is uploading a file to a server and getting the ID of the file (which is assigned by another system I have no control over).
In simple terms, the function is something like this:
def upload_file(filepath): # Set up filedata with values result = upload_to_server(filedata) return result['id']
I'm not debating whether or not to disregard CQS, but I am wondering how to make this especially clear to a user. For instance
upload_file doesn't make the return value explicit, but
get_upload_file is also ambiguous. A docstring is an obvious must to make the function explicit for anyone who reads that.
But I was wondering are there any other helpful patterns that can make it explicit that a function performs actions and returns a value. Or alternatively, should I just focus on making one of these aspects clear and not worry about fully informing the user?