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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:41:38+00:00 2026-06-09T20:41:38+00:00

I want to be able to do the following class Parent: def __init__(self): pass

  • 0

I want to be able to do the following

class Parent:
    def __init__(self):
        pass
    def Create(self):
        return 'Password'

class Child(Parent):
    def __init__(self):
        self.Create()
    def Create(self):
        return 'The '+self.Create #I want to return 'The Password'

I would like to get a parent function from a child class in a function that is overriding it. I am not sure how to do this.

This is a little hard to explain, comment if you are having trouble understanding.

Edit:

Thanks for the answers everyone, I almost thought that this was impossible.

  • 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-09T20:41:39+00:00Added an answer on June 9, 2026 at 8:41 pm

    The super() function is meant for cases like this. However, it only works on “new-style” classes, so you’ll need to modify your definition of Parent to inherit from object as well (you should always be using “new-style” classes, anyway).

    class Parent(object):
        def __init__(self):
            pass
        def Create(self):
            return 'Password'
    
    class Child(Parent):
        def __init__(self):
            self.Create()
        def Create(self):
            return 'The ' + super(Child, self).Create()
    
    
    print Child().Create() # prints "The Password"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to create an instance of a parent class X,
I have the following class, and want to pass the text variable as RoutedEventArgs.
I have a abstract Parent class that has multiple children. I'd like the child
I want to create a class structure that can represent the following heirarchichal structure
I want to be able to do the following actions with a form submit
I want to be able to do the following: NSString *hoursAndMinutes = [myNSDateObject formattedTime];
I want to be able to achieve the following using guice/gin: Get all sort
I want to be able to parse the following times using ParseExact() function: 01:02:03
I want to be able to do the following: get '/:slug' do haml :page
I want to be able to initialize a CArticle having the following properties: Private

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.