python - class - AttributeErr - but method defined
<pre><code>class Card(object):
    suitList = ("Clubs", "Diamonds", "Hearts", "Spades")
    rankList = ("narf", "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King")

    def __init__(self, suit = 0, rank = 2):
        self.suit = suit
        self.rank = rank
    def __str__ (self):
        return "%s of %s" % (self.rankList[self.rank], self.suitList[self.suit])
    # override built-in compare fuction:
    def __cmp__(self, other):
        # use if instead of if...elif..else
        if self.suit &gt; other.suit: return 1
        if self.suit &lt; other.suit: return -1

        if self.rank == 1 and other.rank != 1: return 1
        if self.rank != 1 and other.rank == 1: return -1
        if self.rank &gt; other.rank: return 1
        if self.rank &lt; otehr.rank: return -1

        return 0

# test code
card1 = Card(0, 12)
card2 = Card(1, 2)
print card1.cmp(card2)
</code></pre>

<p>below is the err msg:
Traceback (most recent call last):
  File "C:\Python27\OOP_thecardclass.py", line 29, in 
    print card1.cmp(card2)
AttributeError: 'Card' object has no attribute 'cmp'</p>

<p>Why? Thanks!</p>
