<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Always makes me think of my favorite C snippet: <div><br></div><div>if (attack = true) {</div><div>    launch_nukes(); </div><div>}<br><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><br class="Apple-interchange-newline">Well, I have to admit that I'm drawing a blank on all the great use cases I had in mind, and it didn't seem to light any particular fires with the list, so I'd say this isn't a compelling enough story to take anymore time with at the moment.  If a good–and not obscure–example comes to mind, I'll send it out, otherwise, thanks for the feedback!<br class="Apple-interchange-newline"><br class="Apple-interchange-newline"><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Shane Green </div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><a href="http://www.umbrellacode.com">www.umbrellacode.com</a></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">408-692-4666 | <a href="mailto:shane@umbrellacode.com">shane@umbrellacode.com</a></div>
</div>
<br><div><div>On Mar 27, 2013, at 10:58 PM, Bruce Leban <<a href="mailto:bruce@leapyear.org">bruce@leapyear.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><div class="gmail_quote">On Wed, Mar 27, 2013 at 10:48 PM, Shane Green <span dir="ltr"><<a href="mailto:shane@umbrellacode.com" target="_blank">shane@umbrellacode.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div style="word-wrap:break-word">That's clever: even works for zero because it's returned by or as second false.  Cool.  So I suppose I have to come up with more examples now ;-)  <div><br></div><div>Actually, on that point, I actually think the seen.added(value)  (with a better name) is quite a bit cleaner than the one using "or".   Clever as it is, I think someone learning the language would flinch when they saw that… :-)</div>

</div></blockquote><div><br></div><div>Yes, I suppose it's a bit obscure but you're only going to use it in a case where you value brevity over clarity, right?</div><div> </div><div>The C comma operator which always returns the second value, not depending that the first value is false. You can write this in Python as:</div>

<div><br></div><div><font face="courier new, monospace">    (foo, bar)[1]</font></div><div><br></div><div>or is there some cleaner way to write that?</div><div><br></div><div><font face="courier new, monospace">    #define comma  and False or</font></div>

<div><font face="courier new, monospace">    :-)</font></div><div> </div><font face="arial, helvetica, sans-serif">--- Bruce</font><div><span style="font-family:arial,helvetica,sans-serif">Latest blog post: Alice's Puzzle Page </span><a href="http://www.vroospeak.com/" target="_blank" style="font-family:arial,helvetica,sans-serif">http://www.vroospeak.com</a></div>

<div><div><font face="arial, helvetica, sans-serif">Learn how hackers think: <a href="http://j.mp/gruyere-security" target="_blank">http://j.mp/gruyere-security</a></font></div></div><div> </div></div>
</blockquote></div><br></div></body></html>