I like to call it the plural of what's in it. So, for example, if I have a list of names, I call it names , and then I can write:
for name in names:
which, I think, looks pretty pretty. But in general, for your own sanity, you must specify your variables so that you can know that they are on behalf of. This convention has the added benefit of being a type agnostic, just like Python itself, because names can be any iterable object, such as a tuple, dict, or your own (iterable) object. You can use for name in names for any of them, and if you have a tuple called names_list , that would just be weird.
(Added from the comment below :) There are several situations where you do not need to do this. Using a canonical variable of type i to index a short loop is fine, because i usually used this way. If your variable is used on more than one page with code, so you cannot immediately see it all your life, you should give it a reasonable name.
andronikus
source share