Is there a technic to avoid this bug

hg hg at nospam.org
Tue Feb 27 00:26:44 EST 2007


Hi,

In C/C++ I got used to  write an expression like so:

#define TEST 0

if (TEST == value) 
{

}

in order to avoid the usual bug:
if (value = TEST)
{

}

In a relatively similar domain, I spent a few hours find this bug:

value == self.Get_Value()
if value == WHATEVER:
   do this

instead of
value = self.Get_Value()
if value == WHATEVER:
   do this

Is there a way to avoid such a bug with some type of construct ?

Thanks,
hg





More information about the Python-list mailing list