title: Python - Calling methods inside a class, from inside a class
body: <p>I am currently trying to create a little piece of code that will return a full deck of cards. I am trying to call the createDeck() method from within the <strong>init</strong>() method. For some reason there is an error showing up. Can anyone explain a solution around this, or why it is not working? I tried removing the class, and only having the methods, and it worked perfectly. </p>
  
  <pre><code>class FullDeck():
      '''
      Returns a full 52 card deck
      '''
      names = ('Ace','One','Two','Three','Four','Five','Six','Seven','Eight',
                  'Nine','Ten','Jack','Queen','King')     
      suits = ('Hearts','Spades','Clubs','Diamonds')
      def __init__(self):
          self.deck = createDeck()
  
      def createDeck(self):
          currentDeck = []
          for it1 in FullDeck.names:
              for it2 in FullDeck.suits:
                  currentDeck.append(it1 + ' of ' + it2)
          return currentDeck
  </code></pre>