Are there any sort of 'gotchas' associated with having a constant that is a list, or any other mutable object?
Currently my context has to do with constants that will be passed to a call, but I ask the question generically as I don't feel that topic impacts the question meaningfully.
Consider this example code:
#!/usr/bin/env python
# This file was not tested before posting.
import subprocess
LS_FLAGS = ['-l', '-a']
def main():
subprocess.call(['ls'] + LS_FLAGS)
if __name__ == '__main__':
main()
I ask this because I am deathly aware of the problems that an arise from mutable objects in function definitions; And, even as I understand that there should never be anything doing assignment or mutation to a respected constant; and that "constants" are not really a thing: I ask, and further ask, might there be some conventions for semantically protecting ones self again't accidental mutations?