[Tutor] "x and y" means "if x is false, then x, else y"??

Lie Ryan lie.1296 at gmail.com
Thu Jul 22 17:41:59 CEST 2010


On 07/05/10 22:23, Adam Bark wrote:

> 
> I should add that this is how something like:
> 
> if x != y:
>     do_something()
> 
> works, if expects a True or False (this isn't always true but works for
> comparison operators expressions such as this).
> 

<nit> "if" expects an expression that can be converted to True or False
by calling its __bool__()/__nonzero__(); in case of missing
__bool__/__nonzero__, then the object is considered True. </nit>



More information about the Tutor mailing list