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

Sibylle Koczian nulla.epistola at web.de
Wed Jun 12 17:16:13 EDT 2013


Am 12.06.2013 22:00, schrieb Νικόλαος Κούρας:
> On 12/6/2013 10:48 μμ, Sibylle Koczian wrote:
>>> 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.
>
> okey first the expression eval:
>
> ( name and month and year ) = ( name=True and month=True and year=True )
>
No. Read MRABs post, he explains it. Or work through the tutorial. This 
would be right in another language, but not in Python.

If this expression would really evaluate to True or False, you 
definitely couldn't search for any character in the result.

As it is, it evaluates to a string or to None, but searching for '=' in 
that string doesn't give the result you think it does.

Greetings
Sibylle




More information about the Python-list mailing list