Message197285
| Author |
pitrou |
| Recipients |
eli.bendersky, ethan.furman, pitrou |
| Date |
2013年09月08日.16:49:38 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1378658975.3251.8.camel@fsol> |
| In-reply-to |
<1378658376.75.0.951636721817.issue18929@psf.upfronthosting.co.za> |
| Content |
> It seems that currently inspect is geared towards instances and
> classes, not metaclasses. Consequently, so is help.
I'm afraid I don't really understand what you're talking about. A
metaclass is just a slightly different kind of class :-)
> def classify_class_attrs(cls):
> """Return list of attribute-descriptor tuples.
>
> For each name in dir(cls), the return list contains a 4-tuple
> with these elements:
[...]
> We could add additional 'kind' of 'hidden class method', and 'hidden
> class attributes' and then have classify_class_attrs explicitly search
> metaclasses.
The docstring is clear: "For each name in dir(cls)". If you want stuff
that hidden's in the cls.__class__ (and, consequently, not in dir(cls)),
then you are not looking for the right function, I think.
I can understand wanting to better automate lookup of methods on
classes, rather than on instances, but it would probably deserve another
function.
But I have another question first: doesn't calling
classify_class_attrs() on the metaclass already do what you want? |
|