<html><body bgcolor="#FFFFFF"><div><div>Dave, Myles, et al,<br></div><div><br>On Nov 27, 2011, at 4:25 PM, Dave Angel &lt;<a href="mailto:d@davea.name"><a href="mailto:d@davea.name">d@davea.name</a></a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div><span>On 11/27/2011 05:17 PM, myles broomes wrote:</span><blockquote type="cite"><span></span></blockquote><blockquote type="cite"><span></span></blockquote><blockquote type="cite"><span></span></blockquote><blockquote type="cite"><span></span></blockquote><blockquote type="cite"><span></span></blockquote><blockquote type="cite"><span></span></blockquote><blockquote type="cite"><span></span></blockquote><blockquote type="cite"><span>#random order list</span><br></blockquote><blockquote type="cite"><span>while len(random_word_list) != len(word_list):</span><br></blockquote><blockquote type="cite"><span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;word = random.choice(word_list)</span><br></blockquote><blockquote type="cite"><span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if word not in random_word_list:</span><br></blockquote><blockquote type="cite"><span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;random_word_list += word</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><span>If you use &nbsp;+= operator with list on the left side, it assumes something compatible with list on the right. &nbsp;So either use</span><br><span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;random_word_list &nbsp;+= &nbsp;[word]</span><br><span>Or else use random_word_list.append(word)</span><font class="Apple-style-span" color="#005001"><font class="Apple-style-span" color="#0023A3"><br></font></font><blockquote type="cite"><span></span></blockquote><blockquote type="cite"><span></span></blockquote><blockquote type="cite"><span></span></blockquote><blockquote type="cite"><span></span></blockquote><blockquote type="cite"><span></span></blockquote></div></blockquote><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); "><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); "><br></span></div><div>Everyone has offered some good feedback, I just wanted to throw in this, and hopefully everyone can say if I'm correct or not:</div><div><br></div><div>A way to make the code more 'pythonic' and easier to read might be to replace the conditional&nbsp;</div><div>while len(random_word_list) != len(word_list)</div><div>With the following :</div><div>For x in range(len(word_list))</div><div>This will prevent infinite loops, easier to read, and allows for a lot of other uses (even if x is never used). &nbsp;Any thoughts people? &nbsp;And would this method (on a small or large scale) be 'cheaper' than the original conditional? Or more 'pythonic'?</div><div><br></div><div>Charles</div><div><br></div>Sent from my iPhone</span><br></div><div><span></span></div></body></html>