On Tue, Apr 19, 2011 at 4:23 PM, Kushal Kumaran
<kushal.kumaran+pyt...@gmail.com> wrote:
>> if a + b + c + d != 1:
>>    raise ValueError("Exactly one of a, b, c or d must be true.")
>>
>
> Unless you're sure all of a, b, c, and d are boolean values, an int
> with a negative value slipping in could result in the sum equaling 1,
> but more than one of the variables evaluating to True in boolean
> contexts.

If they're all expressions, then you can easily guarantee that.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to