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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:43:43+00:00 2026-06-11T19:43:43+00:00

I have the following code.py file: class Shape: def __init__(self, x, y): self.x =

  • 0

I have the following code.py file:

class Shape:
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def move(self, delta_x, delta_y):
        self.x += delta_x
        self.y += delta_y

class Square(Shape):
    def __init__(self, side=1, x=0, y=0):
        super().__init__(x, y)
        self.side = side

class Circle(Shape):
    def __init__(self, rad=1, x=0, y=0):
        super().__init__(x, y)
        self.radius = rad

I’m running the code in the Python interpreter like this:

>>> import code
>>> c = code.Circle(1)

I’m getting this error:

Traceback (most recent call last):<br>
...<br>
File "code.py", line 18, in __init__<br>
super().__init__(x, y)<br>
TypeError: super() takes at least 1 argument (0 given)<br>

I don’t understand why I’m getting this error. I’m specifying a rad value of 1 and I would assume that since I didn’t specify x and y values, Circle should be using the default values of x=0 and y=0 and passing them to Shape via the super() function. What am I missing?

BTW, I’m using Python 2.7.1.

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-06-11T19:43:44+00:00Added an answer on June 11, 2026 at 7:43 pm

    super requires an argument and this is exactly what the error message is saying. In your case you need to use super(Circle, self) and super(Square, self).

    For the gory details you can see this SO question or you can just check the official documentation.

    Note that unless you want to do funny things the code can be simplified in

    Shape.__init__(self, x, y)
    

    in both cases. Until you understand super and why it can be useful I would suggest to simply stay away from it. You can live an happy life as a productive Python programmer without touching that.

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

Sidebar

Related Questions

Have a look at the following piece of code Header File: class CxUser {
I have the following code in an Active Record file. class Profile < ActiveRecord::Base
I have the following C++ code to make dll (Visual Studio 2010). class Shape
I have the following json code file named: sections.json { section1: { priority: 1,
I am working with NSCache in iOS i have following code in .h file
I have the following code reading a file containing unicode text (Japanese). File f
When I using the following code to read file: lines=file(data.txt).read().split(\n) I have the following
Possible Duplicate: Are file descriptors shared when fork()ing? Suppose I have following code in
I have the following code in one cpp file which is part of a
I have the following code that returns a .CSV file when a link is

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.