> On 31/12/16 00:26, Deborah Swanson wrote: > > As Mr. Bieber points out, what I had above greatly benefits > from the > > use of conjunctions. It now reads: > > > > if not len(l1[st]) and len(l2[st]): > > IMHO, "if not len(l)" is a _terrible_ way of spelling "if > len(l) == 0" > (mentally, I have to read that as "if length of 'l' is not > not equal to > 0" - and a double negative won't never cause problems ( ;) )). > > Also, in that particular expression, having to know off the > top of their > head the precedence of 'not' and 'and' will cause at least some > percentage of your maintenance audience in the future to get it wrong. > > What's wrong with: > > if len(l1[st]) == 0 and len(l2[st]) != 0: > ... > > ?
Absolutely nothing wrong, and you're right that it's more readable. I just think it's cool that Python will do the right thing with not len(a) and len(a). > There is _no way_ someone could read that and get the wrong idea. > > E. Quite true. -- https://mail.python.org/mailman/listinfo/python-list