Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read Method
#6
(Jan-19-2020, 04:45 PM)Gribouillis Wrote:
JohnnyCoffee Wrote:What I need to find out if it is possible to know is whether a method of a particular class exists?
Try this for example
 >>> class A: ... def foo(self): pass ... def bar(self): pass ... >>> help(A) 
Output:
class A(builtins.object) | Methods defined here: | | bar(self) | | foo(self) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined)

Okay, is there any way to access the class file and see if a certain method exists?
Reply


Messages In This Thread
Read Method - by JohnnyCoffee - Nov-10-2019, 04:24 PM
RE: Read Method - by Gribouillis - Nov-10-2019, 04:39 PM
RE: Read Method - by ChislaineWijdeven - Nov-20-2019, 12:38 PM
RE: Read Method - by JohnnyCoffee - Jan-19-2020, 02:41 PM
RE: Read Method - by Gribouillis - Jan-19-2020, 04:45 PM
RE: Read Method - by JohnnyCoffee - Jan-22-2020, 04:00 PM
RE: Read Method - by Gribouillis - Jan-22-2020, 05:41 PM
RE: Read Method - by JohnnyCoffee - Jan-22-2020, 11:39 PM
RE: Read Method - by micseydel - Jan-22-2020, 11:47 PM
RE: Read Method - by Gribouillis - Jan-22-2020, 11:49 PM
RE: Read Method - by perfringo - Jan-23-2020, 10:30 AM
RE: Read Method - by JohnnyCoffee - Jan-23-2020, 09:30 PM

Forum Jump:

User Panel Messages

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