471,350 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Listing subtypes

Hi,

I remember seeing an easy way to list all subtypes of a specific type
but I haven't been able to find it anymore. What I am trying to do is
this: Given a class, get a list of all classes that derive from it.
Pretty much like __mro__ but downwards rather then upwards. Any ideas?

-Samuel
Nov 28 '07 #1
2 1569
Ben Finney schrieb:
Samuel <kn******@gmail.comwrites:
>I remember seeing an easy way to list all subtypes of a specific type
but I haven't been able to find it anymore. What I am trying to do is
this: Given a class, get a list of all classes that derive from it.
Pretty much like __mro__ but downwards rather then upwards. Any ideas?

A class knows its parents; it doesn't know its children. (Or, in other
words, children need to know who their parents are, but aren't
required to notify their parents about anything.)
Not right. These special children are under a more demanding goverment.
class A(object):
pass

class B(A):
pass

print A.__subclasses__()
http://www.mail-archive.com/py******.../msg67979.html
Diez
Nov 29 '07 #2
On Nov 29, 1:54 am, "Diez B. Roggisch" <de...@nospam.web.dewrote:
print A.__subclasses__()
Ah, I knew I had seen this before. Thanks!

-Samuel
Nov 29 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Chris | last post: by
19 posts views Thread by SU News Server | last post: by
3 posts views Thread by David Jacques | last post: by
1 post views Thread by red floyd | last post: by
1 post views Thread by Johnny Jörgensen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.