6👍
For all practical intents and purposes, this is going to make absolutely no difference at all.
There may be some marginal differences in performance, but any differences in speed in this case would be so incredibly small, that it would never make any difference. There would be other things that would make a much larger difference to performance. If there was an application where performance was important on the kind of scale we are talking about, there is no way you would even be using django-admin for a performance critical part of it anyway. (It is not designed to be a user-facing production ready site).
However…
There is a good reason to use tuples, and not lists though. Convention!! It’s what the official django docs / and everyone else does. It might not seem very important, but if all the code looks the same it makes it more readable.
I can see that you could argue that using a list instead of a tuple wouldn’t affect readability. However, if I was reading some django-admin code and saw lists being used, I’d probably stop and think for a bit about why lists are being used and not tuples. It would just stand out to me, and I’d wonder why it had been done. Eventually I’d realise there was no good reason, and that time would have been wasted.
Similar to why you might use, a style guide (such as PEP8) or formatter (such as black
) to make sure everyone’s code looks the same. It just makes the code a little nicer.
0👍
In admin you should use tuples
The difference between a tuple and a list is that you cannot edit a tuple – it is immutable. For this reason, they are faster for python to create and they use less memory
As you will not be editing the values of those properties you should use tuples