Adding elements to a dictionary of sets
<p>I have a dictionary <code>d</code> of sets. When adding an element under some key <code>key</code> I consider the two cases <code>key in d</code> and <code>not key in d</code>:</p>

<pre><code>from random import randint

for i in range(1000):
    key = randint(0, 100)

    if key in d:
        d[key] |= set([randint(0, 10)])
    else:
        d[key] = set([randint(0, 10])
</code></pre>

<p>Is there a cleaner way to do this? Can I unify the two cases?</p>
