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 1016707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:35:20+00:00 2026-05-16T10:35:20+00:00

I have a python class and within the class I call 2 different methods

  • 0

I have a python class and within the class I call 2 different methods from one of the other methods. One works and one gives me a TypeError: get_doms() takes exactly 1 argument (2 given) :

  def start(self,cursor):
    recs = self.get_recs(cursor)  # No errors here
    doms = self.get_doms(cursor)  # I  get a TypeError here




  def get_doms(self,cursor):
    cursor.execute("select domain from domains")
    doms = []
    for i in cursor._rows:
      doms.append(i[0])
    return doms

  def get_recs(self,cursor):
    cursor.execute("select * from records")
    recs = []
    print cursor._rows
    recs = [list(i) for i in cursor._rows]
    return recs

How do I successfully call methods within my class from other methods within the same class? Why does one work and the other not?
~~thanks~~

  • 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-05-16T10:35:21+00:00Added an answer on May 16, 2026 at 10:35 am

    I can’t reproduce the error you mention. I think the code is okay. But I suggest do not use cursor._rows because the _rows attribute is a private attribute. Private attributes are an implementation detail — they are not guaranteed to be there in future versions of cursor. You can achieve what you want without it, since cursor itself is an iterator:

    def start(self,cursor):
        recs = self.get_recs(cursor)  
        doms = self.get_doms(cursor)  
        print(recs)
        print(doms)
    def get_doms(self,cursor):
        cursor.execute("select domain from domains")
        doms = [row[0] for row in cursor]
        return doms
    
    def get_recs(self,cursor):
        cursor.execute("select * from records")
        recs=[list(row) for row in cursor]
        return recs
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is it possible in python to address class variables from other class variables within
I have a program in python that includes a class that takes a function
I am using Jython within a Java project. I have one Java class: myJavaClass.java
I have a python class with many methods(): Method1() Method2() ........... ........... MethodN() All
I have a python class which reads a config file using ConfigParser: Config file:
You have a Python class which needs an equals test. Python should use duck-typing
I have a python class I want to instantiate and the __init__ definition has
Suppose I have a Python class that I want to add an extra property
I have a model called Customer in google app engine with python: class Customer(db.Model):
I have a Python file with as content: import re import urllib class A(object):

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.