Steven D'Aprano <st...@remove-this-cybersource.com.au> writes: > def assemble_page(header, body, footer): > if header or body or footer: > do_lots_of_expensive_processing() > else: > do_nothing_gracefully()
Why should the processing be expensive if all three fields are empty? > if header or body or footer: > is a huge improvement over: > if (header != '') or (body != '') or (footer != ''): Doesn't really seem any better. There's always something like if any(p != '' for p in [header, body, footer, otherthing1, ...]) if the number of components gets larger. -- http://mail.python.org/mailman/listinfo/python-list