How do I list only the methods I define in a class? For example:
class Produce(): def __init__ (self): print (dir (Produce)) def apples(self): pass def peaches(self): pass def pumpkin (self): pass The print (dir(Produce)) statement displays: ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'apples', 'peaches', 'pumpkin'] I am only interested in 'apples', 'peaches', 'pumpkin' The above is only an example. In my real code there are methods with and without leading "__". Can I assume methods after __weakref__ are the methods I defined? Is there a Python function to do what I need? Thanks, Bruce -- https://mail.python.org/mailman/listinfo/python-list