Anyone know of a way to tell the difference between an inherited class method and a individually defined one?

ie:

class test(str):
   def unique(self):
      pass


x = test()
# how to test for difference between
x.unique
# and
x.lower

Recommended Answers

All 2 Replies

# check if an object is a class or a method of that class instance

import inspect

print( inspect.isclass(str) )  # True

class test(str):
   def unique(self):
      pass


x = test()
# how to test for difference between 
# x.unique
print( inspect.ismethod(x.unique) )  # True

# and x.lower
print( inspect.ismethod(x.lower) )   # False

... Why doesn't that same principle apply to

class MainFrame(wx.Frame):
.....

when I test

inspect.ismethod(MainFrame.WarpPointer)

or any other wx.Frame method it returns "True"

am I missing something really obvious?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.