title: Why object of python class returns address instead of return data?
body: <p>This is my first program in Python and I'm working with some API which is used to log in or register user.</p>
  
  <p>This is how my class looks like:</p>
  
  <pre><code>class MyClass:
      ...
      def __init__(self, apikey, gameid, securitykey, responseformat, 
                   username=None, password=None, email=None)
          self.apikey = apikey
          self.gameid = gameid
          self.securitykey = securitykey
          self.responseformat = responseformat
  
          if username and password:
              self.userlogin(username,password)
          if username and password and email:
              self.userregistration(username, password, email)
  
      ''' And there are function userlogin and userregistration
      i'll show just one of them '''
  
      def userregistration(self, username, password, email):
          securitypayload = self.buildurl(username, password, email)
          user = requests.get('url', params = securitypayload)
          if 'error' in user.text:
              return user.text
          else:
              return 'Success!'
  </code></pre>
  
  <p>I tested this class with code below:</p>
  
  <pre><code>api_test = MyClass('apikeyadfasdf', 'gameiddfdfd', 'seckey34324324', 'JSON', 
                      'admin', 'pass1')
  print(api_test)
  </code></pre>
  
  <p>and I got output like this:</p>
  
  <pre><code>&lt;package1.package2.file_name.MyClass object at 0x7f278388b48&gt;
  </code></pre>
  
  <p>But when I change my test to this:</p>
  
  <pre><code>api_test = MyClass('apikeyadfasdf', 'gameiddfdfd', 'seckey34324324', 'JSON', 
                      'admin', 'pass1')
  data = api_test.userregistration(username, password, email)
  print(data)
  </code></pre>
  
  <p>it'll do the thing and I'll get my output, but it'll execute that function two times.</p>
  
  <p>I was thinking where the problem could be and I remembered that in JAVA you could get similar  output when you forget about override toString(). Now, I've read about python equivalents: <strong>repr</strong> and <strong>str</strong> but firstly I don't know how to return data from methods (not self.apikey etc.) and secondly I'm not 100% sure that is the right way to get my output, not address.</p>