Classes & Instances

Mark McEahern marklists at mceahern.com
Wed Jan 2 20:23:07 CET 2002


class a:
    pass

f = a()

for k in locals().keys():
    if isinstance(locals()[k], a):
        print k

This probably isn't what you want.  I can't help but wonder what problem
you're trying to solve?

Maybe this is an area where metaclasses would help?

// mark





More information about the Python-list mailing list