 <p>Yes. I think <code>foo.string</code> will calulate each time until iteration satisfies <code>True</code>. So you can do this</p> <pre><code>foo_string=foo.string if any(name in foo_string for name in faa.names): </code></pre>