syntax question: "<>" and "!=" operators

Cromwell, Jeremy jcromwell at ciena.com
Fri Mar 15 13:43:20 EST 2002


>From Python Library Reference, section 2.2.3 Comparisons

<> and != are alternate spellings for the same operator. (I couldn't choose
between ABC and C! :-)  != is the preferred spelling; <> is obsolescent.

-Jeremy Cromwell

-----Original Message-----
From: josephgrossberg at hotmail.com [mailto:josephgrossberg at hotmail.com]
Sent: Friday, March 15, 2002 10:13 AM
To: python-list at python.org
Subject: syntax question: "<>" and "!=" operators


Is there any effective difference between the two?

(Sorry if this has already been addressed; it's difficult to search on
punctuation.)

>>> name = "joe"
>>> name <> 'Joe'; name != 'Joe'; name <> 'joe'; name != 'joe'
1
1
0
0

Doesn't this violate the Python principle that " There should be
one--and preferably only one--obvious way to do it." if I'm
interpreting that correctly?
-- 
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list