[kforge-dev] Python bug?

Rufus Pollock rufus.pollock at okfn.org
Fri Dec 16 10:12:39 UTC 2005


John Bywater wrote:
> So, I tracked down a certain problem to this wierdness:
> 
> An object (Register) is created. It has attributes, and methods which 
> work fine. But it is evaluated for 'truth' in an if statement, the 
> result is False. So code that is sensitive to whether an object has a 
> register or not, acts as if there isn't a register, when there really is.

Nasty bug John and one I can imagine caused quite a bit of pain :(. Does 
that mean there is a difference for a Python class X between:

if X != None:
   ....

and:

if X:
   ....

Regards,

Rufus




More information about the kforge-dev mailing list