5 ms·
Don't make it a tuple. A tuple indicates heterogenous data (a record), while a list indicates a sequence of data. If nothing else, use lists because the syntax
by lordmauve 12y ago
Don't make it a tuple. A tuple indicates heterogenous data (a record), while a list indicates a sequence of data.
If nothing else, use lists because the syntax means it stays as a list even if you someday remove all but one option and forget to leave a comma, eg.
REASONS = [
'leaves on the line'
]
vs
REASONS = (
'leaves on the line'
)
- Joeboy 12y agoAfter DDGing a bit it seems like you have a point. I did not know about that semantic difference between tuples and lists in python. It seems like this difference is entirely about the meaning conveyed to a human reader, rather than any technical difference. My guess would be that tuples are generally more efficient, but I have no actual data to back that up with.