(Jun-29-2024, 07:57 PM)ulrich Wrote: print('Dict: ', mc.__dict__) # shows functionAttribute but not methodMethods defined in the class body are part of the class attribute dictionary,not the instance dictionary.
# Instance dictionary >>> mc.__dict__ {'functionAttribute': <function function at 0x000001B9B775EAC0> # Class attribute dictionary,now see the <method> >>> MyClass.__dict__ mappingproxy({'__dict__': <attribute '__dict__' of 'MyClass' objects>, '__doc__': None, '__init__': <function MyClass.__init__ at 0x000002413180EB60>, '__module__': '__main__', '__weakref__': <attribute '__weakref__' of 'MyClass' objects>, 'method': <function MyClass.method at 0x000002413180EC00>})