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 zod, the zero or divide function, is useful for division where the denominator can be 0. For example, here's one line of code > stat = x / y If y can be zero, that one-liner needs to be rewritten as: > if y != 0: > stat = x / y > else: > stat = 0 ...which is 4 lines of code for simple division! Using zod, the zero or divide function, we can write: > stat = zod(x,y) I've encountered this issue before, but I don't know how common it is. Let me know! Would you use zod? Or do you need ood (one or divide), in which case lets forget this altogether! Natan -- blog: http://natanyellin.com <http://natanyellin.com/>twitter: @aantn <http://twitter.com/aantn>
-- http://mail.python.org/mailman/listinfo/python-list