I create a list of 24 floats that is needed in a calling function. The calling function will not need to alter the floats, so it can work with a tuple. Is it computationally faster to change the list to a tuple, tuple(list), before returning it to the calling function rather than passing and then using the list the entire time?
A corollary to this is: Should I change a list to a tuple within a function if the function can work with the tuple? I have many instances of creating a list, then using it later in the same function where a tuple of the list would work.
I have several instances of this in my program, so any speed advantage would be helpful to overall performance.
I don't know how to time these things and cannot find a past similar question. I know tuples are more about 3 times faster.
Code sample not needed.