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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:38:38+00:00 2026-06-11T21:38:38+00:00

Possible Duplicate: Why do I have to specify my own class when using super(),

  • 0

Possible Duplicate:
Why do I have to specify my own class when using super(), and is there a way to get around it?

I was reading this book – "Core Python Programming", and I really found it very nice I would say. But I got confused at a point while I was studying the topic Inheritance..

The book somewhere said that- we can use super() to invoke super class method which will find the base class method for us and also we don’t need to pass self explicitly, like we do without super..

Here’s the sample code: –

# Invoking super class method without super() .. Need to pass `self` as argument
class Child(Parent):
    def foo(self):
        Parent.foo(self)

# Invoking with super().
# No need to pass `self` as argument to foo()
class Child(Parent1, Parent2):
    def foo(self):
        super(Child, self).foo()
        print 'Hi, I am Child-foo()'

My Question is – why we have to pass the classname to super() call.. As the classname can be inferred from the class from which super is invoked..

So, since super() is invoked from
class Child, classname should be implicit there.. So why do we need that??

*EDIT: – Giving Child as a parameter to super() doesn’t make sense, because it doesn’t give any information.. We could have used super(self).. And the method would have been searched in the super classes in the order they are given inside parenthesis..

  • 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-11T21:38:39+00:00Added an answer on June 11, 2026 at 9:38 pm

    By providing the class name as first argument you provide redundant information. Yes. That’s a bit stupid* and that’s why the behavior of super is changed in Python 3 to:

    super().__init__()
    

    *With my answer I actually contradict the answer by John Carter. Only one of us is right, of course. I don’t want to offend him and others and I am happy to see a meaningful example where super(C, self).method(arg) is not actually used within class C :-).

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

Sidebar

Related Questions

Possible Duplicate: Does JavaScript have a range() equivalent? Is there a way to declare
Possible Duplicate: php multi-dimensional array remove duplicate I have an array like this: $a
Possible Duplicate: jquery data selector I have several elements with class 'connection_name'. Each one
Possible Duplicate: Specify Command for MenuItem in a DataTemplate I have a collection of
Possible Duplicate: Any way to specify optional parameter values in PHP? just randomly came
Possible Duplicate: splitting a string i have a string which looks like this: http://pastebin.com/m5508ff19
Possible Duplicate: Reading csv file I have a comma delimited file: Some Text, More
Possible Duplicate: Custom Collection Initializers I have a simple Pair class: public class Pair<T1,
Possible Duplicate: how to specify a pointer to an overloaded function? I have a
Possible Duplicate: How to get the insert ID in JDBC? Hi, I'm using JDBC

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.