My general rule is that the greater the scope -- lexical or runtime -- of a variable, the more descriptive its name (which often means longer but not always!)<p>So, for a short lived variable, I'm personally ok with it being short, as in, some random bit of python:<p><pre><code> # strip the last char from everything in a list
some_list = [s[:-1] for s in some_list]
</code></pre>
IMHO, I don't really think it matters what 's' is here, and I don't think it would would be that helpful if given a more meaningful name. The cognitive load is small.<p>Conversely, variables that live a long time and/or operate globally are better off with a longer name.<p>However, I would observe that your example might suggest a coding issue, the tipoff being 'and'. If a single variable is handling two chunks of state, then perhaps it's doing too much and you might be better off with something like:<p><pre><code> val documentSavedOnDiskJsonStates...
val pdfSavedOnDiskJsonStates
</code></pre>
Not huge savings there, but perhaps also things might get clearer encapsulating these things in a class, with methods like (just making stuff up):<p><pre><code> document = Document.getFromDisk()
document.jsonStates()
</code></pre>
Not saying that this is always the correct approach or valid in your particular case, just making the general observation that IME highly modular code tends to require fewer really long names.