On Mon, Apr 11, 2011 at 5:20 PM, Chris Angelico <ros...@gmail.com> wrote:

> On Tue, Apr 12, 2011 at 12:10 AM, Natan Yellin <aan...@gmail.com> wrote:
> > Hey everyone,
> > This is my first posting to python-list, so be gentle.
> > I propose the following function for the math module (which can, of
> course,
> > be rewritten in C):
> >>
> >>  zod = lambda a, b: b and a / b
> >
> > If y can be zero, that one-liner needs to be rewritten as:
> >>
> >> if y != 0:
> >>     stat = x / y
> >> else:
> >>     stat = 0
>
> You can optimize that the same way as your zod function:
> stat = y and x/y

I'm dealing with long-named variables inside of dictionaries, which makes
that impractical.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to