Pierre Quentel wrote:
> In some program I was testing if a variable was a boolean, with this 
> test : if v in [True,False]
> 
> My script didn't work in some cases and I eventually found that for v = 
> 0 the test returned True

This seems like a strange test.  What is this code trying to do?

If you're sure you have to do this, I would do either:

     if isinstance(v, bool):
         ...

or

     if v is True or v is False:
         ...

But it really seems like this code is trying to code some other language 
in Python...

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

Reply via email to