On 12/6/2013 8:53 μμ, MRAB wrote:

and then what this is doing?

if '=' not in ( name or month or year ):

In English, the result of:

     x or y

is basically:

     if bool(x) is true then the result is x, otherwise the result is y

For example:

 >>> bool("")
False
 >>> "" or "world"
'world'
 >>> bool("Hello")
True
 >>> "Hello" or "world"
'Hello'

These can be strung together, so that:

     x and y and z

is equivalent to:

     (x and y) and z

and:

     x or y or z

is equivalent to:

     (x or y) or z

and so on, however many times you wish to do it.

Never before i used not in with soe many variables in parenthesi, up
until now i was specified it as not in var 1 and not in var 2 and not in
var 2 and so on....

Keep it simple:

     if '=' not in name and '=' not in month and '=' not in year:

There may be a shorter way, but you seem confused enough as it is.


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


if '=' not in ( name and month and year ):
i understand: if '=' not in name AND '=' not in month AND '=' not in year


if '=' not in ( name or month or year ):
i understand: if '=' not in name OR '=' not in month OR '=' not in year


but i know it does not work like this, but tis is how i understand it. its like reading an English sentence


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

Reply via email to