Username
Password
Auto-login
Show my name in the online users list
Not a member?
Please register.
Forgot your password?
(2) September 2008
(7) August 2008
(6) July 2008
(9) June 2008
(4) May 2008
(6) April 2008
(6) March 2008
(4) February 2008
(5) January 2008
(8) December 2007
(4) November 2007
(3) September 2007
and or
Posted: May 07, 2007 - 06:16 PM
Category: Python
I was writing a python script and errored out with invalid syntax on:

if (val && v==2):

I had forgotten a difference between MEL and Python operators.

MEL &&, Python and
MEL ||, Python or

So, I changed the code to:

if (val and v==2):

and my script worked as expected. With that, I will refer to my last post about different style quotes and readability – I think the python way is a bit nicer.

Speaking of “bit” - in Python, & is the bitwise and. | is the bitwise or.

Did this make you any wiser?
In order to post any comments, you must be logged in!
  Posted by mogkc  on  05/31  at  07:54 AM
Maybe the best answer is to point you to the What's New in python 2.5:

http://docs.python.org/whatsnew/pep-308.html

Thanks to Steven for pointing it out to me smile
  Posted by paulalso  on  05/08  at  02:07 AM
I've been stumbling over python's version of a ? b : c
 
Page 1 of 1 pages