A certainl part of an if() structure never gets executed.

Sibylle Koczian nulla.epistola at web.de
Wed Jun 12 15:48:19 EDT 2013


Am 12.06.2013 20:06, schrieb Νικόλαος Κούρας:
> Whn i see:
>
> if( x and y ):
> i understand: if x expression = True AND ALSO y expression = True then
> execute
>
>
> if( x or y ):
> i understand: if x expression = True OR y expression = True then execute
>
You didn't read MRABs explanation, did you?

> if '=' not in ( name and month and year ):
> i understand: if '=' not in name AND '=' not in month AND '=' not in year
>
Wrong. The "'=' not in (...)" first evaluates the expression in 
parentheses, that's what parentheses are for. And then it looks for '=' 
in the result. And that result is just one of the three values, MRAB 
told you which one.

>
> if '=' not in ( name or month or year ):
> i understand: if '=' not in name OR '=' not in month OR '=' not in year
>
Same here. You can't take the "'=' in" out of the parentheses, that 
leads to a wrong result.
>
> but i know it does not work like this, but tis is how i understand it.

??? If you know it doesn't work like this, then it won't help you to 
wilfully understand something you'd like to be true.

> its like reading an English sentence
>
No, this time it isn't.

HTH
Sibylle




More information about the Python-list mailing list