That definitely won't work. How could the language possibly determine if you meant
a == b | a == c as opposed to the literal a == b | c What this becomes is a == (b | c) Also be aware that | is a "bitwise or" and not a logical "or" which may not be what you want. So your original expression may not be what you want since it will get evaluated as a == (b | a) == c Consider the following result: >>> a=0 >>> b=0 >>> c=1 >>> print a == b | a == c False >>> print a == (b | a) == c False >>> print (a == b) | (a == c) True >>> print a == b | c False Although what I suspect you really want is >>> print a == b or a == c True >>> print (a == b) or (a == c) True But this means that your shortcut becomes (a == b) or c So consider >>> a=0 >>> b=1 >>> c=0 >>> print a == b or c 0 Which is the same as false. Jeff -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Bear Sent: Friday, August 31, 2007 3:40 PM To: tutor@python.org Subject: [Tutor] or synxtax in if statement I think I want to be lazy and express this if a == b | a = c (if a equal b or a equals c) using if a == b | c it seems to work.. but I'm not sure if it is correct -- and I haven't seen any documentation on using this type of syntax. -- -- David Bear College of Public Programs at Arizona State University _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor