What effect has a statement like 'var and do_something_with(var)' in Python?
<p>While looking for some answers in a package source code (<em>colander</em> to be specific) I stumbled upon a string that I cannot comprehend. Also my <em>PyCharm</em> frowns on it with 'statement seems to have no effect'.</p>

<p>Here's the code abstract:
</p>

<pre><code>...
for path in e.paths():
    keyparts = []
    msgs = []
    for exc in path:
        exc.msg and msgs.extend(exc.messages()) # &lt;-- what is that?
        keyname = exc._keyname()
        keyname and keyparts.append(keyname) # &lt;-- and that
    errors['.'.join(keyparts)] = '; '.join(interpolate(msgs))
return errors
...
</code></pre>

<p>It seems to be extremely pythonic and I want to master it!</p>

<p>UPD. So, as I see it's not pythonic at all - readability is harmed for the sake of shorthand.</p>
