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 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 class based on TInterfacedObject. i add it to TTreeNode's Data property.
I have a class that defines a CallRate type. I need to add the
I have a class of type ISimpleCache<IBrokeredDataObject> that I want to add as a
I have dbml with single table users i want add partial class for User
hi i forgot the code which in a sample class you have to add
I have Excel add-in which I add so many class modules that it is
I have a requirement to add conditional disabled & class attributes to a dropdown
I would like to add an operator to a class. I currently have a
I have class method that returns a list of employees that I can iterate
I have: class MyClass extends MyClass2 implements Serializable { //... } In MyClass2 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.