Python: what's the pythonic way to perform this loop?
<p>What is the pythonic way to perform this loop. I'm trying to pick a random key that will return a subtree and not the root. Hence: 'parent == None' cannot be true. Nor can 'isRoot==True' be true.</p>

<pre><code>thekey = random.choice(tree.thedict.keys())
while (tree.thedict[thekey].parent == None)or(tree.thedict[thekey].isRoot == True):
        thekey = random.choice(tree.thedict.keys())
.......
</code></pre>

<p>edit: it works now</p>
