Python Forum
Listing All Methods Of Associated With A Class
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Listing All Methods Of Associated With A Class
#1
Hello

I wanted to ask whether it was possible to list all the methods associated with a Class for example:-

I have created the following class:-

class Human():

    
    def __init__(self, sex, eyecolor, height, yearborn):
     
        self.sex = sex
        self.eyecolor = eyecolor
        self.height = height
        self.yearborn = yearborn
        
        print("Object", self.sex, self.eyecolor, self.height, self.yearborn, "Has been created")
        
    
    def age(self):
        currentdate = date.today()
        a = currentdate.year - self.yearborn
        return a
    
    def display(self):
        print(self.sex)
        print(self.eyecolor)
        print(self.height)
        print(self.yearborn)
        
In the above class I have created I have 2 x methods age() and display().

My question is this: is there any Python code that allows me to enter the name of the class and the output are all the methods associated with that class?

Thank you.
Reply


Messages In This Thread
Listing All Methods Of Associated With A Class - by JoeDainton123 - May-09-2021, 04:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Class test : good way to split methods into several files paul18fr 4 471 Jan-30-2024, 11:46 AM
Last Post: Pedroski55
  Structuring a large class: privite vs public methods 6hearts 3 1,049 May-05-2023, 10:06 AM
Last Post: Gribouillis
  Listing directories (as a text file) kiwi99 1 834 Feb-17-2023, 12:58 PM
Last Post: Larz60+
  Read directory listing of files and parse out the highest number? cubangt 5 2,333 Sep-28-2022, 10:15 PM
Last Post: Larz60+
  access share attributed among several class methods drSlump 0 1,057 Nov-18-2021, 03:02 PM
Last Post: drSlump
  a function common to methods of a class Skaperen 7 2,573 Oct-04-2021, 07:07 PM
Last Post: Skaperen
  too many methods in class - redesign idea? Phaze90 3 2,488 Mar-05-2021, 09:01 PM
Last Post: deanhystad
  Special Methods in Class Nikhil 3 2,269 Mar-04-2021, 06:25 PM
Last Post: Nikhil
  Listing files with glob. MathCommander 9 4,921 Oct-26-2020, 02:04 AM
Last Post: MathCommander
  Listing data from a list ebolisa 1 1,732 Sep-29-2020, 02:24 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020