How should I conditionally assign based on the existence of a dictionary key?
<p>I've got some Perl code like this:</p>

<pre><code>my $match = $matches{$key}
            ? "$matches{$key} was a match!"
            : "There was no match."
</code></pre>

<p>How is this best rewritten in Python? I'm trying to avoid getting a KeyError.</p>
