Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9002183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:32:10+00:00 2026-06-16T00:32:10+00:00

Working with classes in one of my projects for the first time, I seem

  • 0

Working with classes in one of my projects for the first time, I seem to be making a mistake somewhere that I can’t pick.

class aiRespond:
    def generateResponse( self, external_input ):
        return external_input

    def giveResponse( self, external_input ):
        self.generateResponse(self, external_input)

aiResponder = aiRespond()
retrieve_ai_response = aiResponder.giveResponse()

while 1:
    external_input = raw_input("> ")
    print retrieve_ai_response(external_input)

Error:

TypeError: unbound method giveResponse() must be called with aiRespond instance as first argument (got str instance instead)

I have tried many different ways of structuring this. I would prefer retrieve_ai_response = aiRespond.giveResponse to be in one line as I am going to have a lot of things similar to this.

Would someone mind pointing out where I’m going on and why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:32:11+00:00Added an answer on June 16, 2026 at 12:32 am
    class aiRespond:
        def generateResponse( self, external_input ):
            return external_input
    
        def giveResponse( self, external_input ):
            return self.generateResponse( external_input) #remove self as parameter,add return
    
    aiResponder = aiRespond()
    retrieve_ai_response = aiResponder.giveResponse #remove "()"
    
    while 1:
        external_input = raw_input("> ")
        print retrieve_ai_response(external_input)
    

    I have modified you code,Hope it works!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working in a project with multiple classes. Upon importing one of the
So, I am working on a scheduler in one of my classes. Basically, we
Okay guys, I am working hashmap, using one of my classes as Key. My
Here's the domain classes I'm working with: class Foo { String name, type static
I am working with a set of T4 script that generate partial classes for
I'm working on a graphics application that is using virtual classes fairly extensively. It
I'm working on my first game and I have a little over 20 classes.
This is the first time I've encountered something like below. Multiple Threads (Inner classes
I'm working on my very first project outside the college. I have two classes.
I prefer to use OOP in large scale projects like the one I'm working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.