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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:07:45+00:00 2026-05-17T00:07:45+00:00

I have a class where I add new methods and properties dynamically. The new

  • 0

I have a class where I add new methods and properties dynamically. The new properties are handled by overriding __getattr__ and __setattr__ while the new methods are added directly (obj.mymethod = foo). Is there a way to make these show up if I do “help(inst)” where inst is an instance of my class? Right now I only see the methods and attributes I have “hardcoded” in the source. The methods do show up if I do “dir(inst)”.

  • 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-17T00:07:46+00:00Added an answer on May 17, 2026 at 12:07 am

    The issue is that help(inst) provides the information about class from which that instance “inst” is derived from.

    say obj is derived from class A, then instead of doing obj.mymethod = foo, if you did A.mymethod = foo, then this will show up in help(obj)

    Look at the example below and it’s output.

    class A(object):
        def __init__(self):
            pass
    
        def method1(self):
            "This is method1 of class A"
            pass
    
    a = A()
    help(a)
    
    def method2(self):
        """ Method 2 still not associated"""
        pass
    
    A.method2 = method2 
    # if you did a.method2 = method2
    # Then it won't show up in the help() statement below
    
    help(a)
    

    As per the documentation, if the argument is any other kind of object, a help page on the object is generated. But from the example above, I see that adding the method in the namespace of class is shown up in help() function but if you added the method to just one instance of that class, then it does not show up in the help().

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

Sidebar

Related Questions

I have a complex django object, which has properties of other class types. This
Normally I write a class and add XML Serialization to it for my web
Long term lurker, first time poster here. I have written a class to model
I am using entity framework with a web service and I have entity partial
Entity Framework 4, POCO objects and ASP.Net MVC2. I have a many to many
I have object Project in my entity. I create project by: public static void
If I'm using an ORM like JPA2 - where I have my entities that
I have an asp.net 4.0 web site that generates email alerts based on several
I've got a Tile class with this method: public object Clone() { return MemberwiseClone();

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.