<div dir="ltr"><div class="gmail_quote">On Mon, Apr 11, 2011 at 5:20 PM, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com">rosuav@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, Apr 12, 2011 at 12:10 AM, Natan Yellin <<a href="mailto:aantny@gmail.com">aantny@gmail.com</a>> wrote:<br>
> Hey everyone,<br>
> This is my first posting to python-list, so be gentle.<br>
> I propose the following function for the math module (which can, of course,<br>
> be rewritten in C):<br>
>><br>
>>  zod = lambda a, b: b and a / b<br>
><br>
</div><div class="im">> If y can be zero, that one-liner needs to be rewritten as:<br>
>><br>
>> if y != 0:<br>
>>     stat = x / y<br>
>> else:<br>
>>     stat = 0<br>
<br>
</div>You can optimize that the same way as your zod function:<br>
stat = y and x/y</blockquote><meta charset="utf-8"><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">I'm dealing with long-named variables inside of dictionaries, which makes that impractical.</span></div>
</div></div>