<div class="gmail_quote">On Fri, Aug 12, 2011 at 1:47 PM, MrPink <span dir="ltr"><<a href="mailto:tdsimpson@gmail.com">tdsimpson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Boy, that was a lot more elegant that I would have thought.<br>
Though hard for a greenhorn like me to really understand how the<br>
assignment are working, etc.<br>
<br>
Anyway, what are these kind of statement call so that I can read up<br>
more on this?<br>
What Python feature are you using?<br>
<div class="im"><br>
  num_whites = ticket_whites & drawing_whites<br></div></blockquote><div><br></div><div>This is a set intersection, using the "bit-wise and" operator (&). It can also be written as either of: </div><div>

    num_whites = (ticket_whites & drawing_whites) # Makes it a bit clearer that the "bit-wise and" operator runs before the "assignment" (=) operator.</div><div>    num_whites = ticket_whites.intersection(drawing_whites) # Calls the actual method rather than using the operator. A bit more verbose.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
  black_matching = ticket_black == drawing_black<br></div></blockquote><div><br></div><div>This is just the result of an equality operator being assigned. It may be a bit clearer if you see it as:</div><div>    black_matching = (ticket_black == drawing_black)</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
<br>
</div>Thanks,<br>
<div><div></div><div class="h5"><br></div></div></blockquote><div><br></div><div>For more details, you can look up sets (both the math kind and the specific Python implementation are relevant):</div><div>    <a href="http://docs.python.org/library/stdtypes.html#set">http://docs.python.org/library/stdtypes.html#set</a></div>

<div>    <a href="http://en.wikipedia.org/wiki/Set_(mathematics)">http://en.wikipedia.org/wiki/Set_(mathematics)</a></div><div>    <a href="http://en.wikipedia.org/wiki/Set_theory">http://en.wikipedia.org/wiki/Set_theory</a></div>

<div><br></div><div>Chris</div></div>