I was wondering if there was a suitable Python convention for distinguishing between functions that either change their arguments or functions that leave their arguments in tact and return a modified copy. For example, consider two functions that apply some permutation. The function ftakes the list as an argument and moves the elements around, and the function gtakes the list, copies it, applies fand then returns the modified copy.
In the above example, I realized what fcan be called permute(x), while it gcan be permutation(x), using verbs and nouns to distinguish. However, this is not always truly optimal, and in some cases it can lead to confusion as to whether the argument will change along the way, especially if a fdifferent value should have been returned.
Is there a standard way to solve this problem?
Joost source
share