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

  • Home
  • SEARCH
  • 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 881963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:21:01+00:00 2026-05-15T12:21:01+00:00

I am writing a program to find adapters, and have made a class called

  • 0

I am writing a program to find adapters, and have made a class called ‘Adapter’. When I pass in two arguments IDLE gives me an error saying I passed in three! Here is the code and stack trace:

#This is the adapter class for the adapter finder script

class Adapter:
    side1 = (None,None)
    side2 = (None,None)
    '''The class that holds both sides of the adapter'''
    def __init__((pType1,pMF1),(pType2,pMF2)):
        '''Initiate the adapter.

        Keyword Arguments:
        pType1 -- The passed type of one side of the adapter. ex: BNC, RCA
        pMF1 -- The passed gender of pType1. ex: m, f

        pType2 -- The passed type of one side of the adapter. ex: BNC, RCA
        pMF2 -- The passed gender of pType2. ex: m, f

        '''

        print 'assigining now'
        side1 = (pType1,pMF1)
        print side1
        side2 = (pType2,pMF2)
        print side2

sideX = ('rca','m')
sideY = ('bnc','f')

x = Adapter(sideX,sideY)
print x.side1
print x.side2

Error:
Traceback (most recent call last):
File "C:\Users\Cody\Documents\Code\Python\Adapter Finder\adapter.py", line 28, in <module>
x = Adapter(sideX,sideY)
TypeError: __init__() takes exactly 2 arguments (3 given)

I don’t understand what the problem is because I’ve only entered two args!

Edit: I’m new to the python language, though I know Java.
I’m using this page as a tutorial: http://docs.python.org/tutorial/classes.html

  • 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-15T12:21:02+00:00Added an answer on May 15, 2026 at 12:21 pm

    Yes, the OP missed the self, but I don’t even know what those tuples-as-arguments mean and I’m intentionally not bothering to figure it out, it’s just a bad construction.

    Codysehi, please contrast your code with:

    class Adapter:
        def __init__(self, side1, side2):
            self.side1 = side1
            self.side2 = side2
    
    sideX = ('rca', 'm')
    sideY = ('bnc', 'f')
    x = Adapter(sideX, sideY)
    

    and see that it is both more readable, and does what I think you intend.

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

Sidebar

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.