<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">Pydoc (and AFAIK loads of other introspection tools as well) currently ignores attributes on metaclasses. I wonder if it would be better to teach pydoc (and possibly inspect as well) about those, and thought it would be better to ask here before starting on a patch.</div><div class=""><br class=""></div><div class="">That is, given the following definitions:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">class Meta (type):</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    def hidden_class(cls):</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">        print('H', cls.__name__)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">class MyObject (metaclass=Meta):</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    @classmethod</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">    def public_class(cls):</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">        print('P', cls.__name__)</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px;" class="">Pydoc will show “public_class” as a class method of “MyObject” when you use “help(MyObject)”, but it will not show that there is a method named “hidden_class” that can be called on “MyObject” (but not on instances of that class).  That is a problem when “hidden_class” is part of the public interface of the class itself.</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">The issue was found in the context of PyObjC (obviously…):  Objective-C classes can and do have instance and class methods of the same name. Those cannot both be a descriptor in the Python proxy class, and that’s why PyObjC uses an metaclass to expose Objective-C class methods to Python code. This works very well, except for some problems with introspection such as the pydoc issue I refer to above.</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Ronald</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div></body></html>