Re: PYTHON: Analog to class.self for modules?

Date : Fri, 31 Mar 2006 15:34:27 +1100
To : XSI(at)Softimage.COM
From : "Aloys Baillet" <aloys.baillet(at)gmail.com>
Subject : Re: PYTHON: Analog to class.self for modules?
Hi Brad,

You can try to loop on the globals and check if any has the type class:
import copy, types
for name, obj in copy.copy(globals()).items():
    print type(obj)
    if type(obj) == types.ClassType:
        print name

Cheers,

Aloys

On 3/31/06, brad <brad@cg-soup.com> wrote:
Here's a fun Python situation. I have a function that needs to check its input by looking at other Classes living inside the same module. Is there an attribute I can call that points to the instance of the module where it lives? This would be analogous to using the self attribute in an object class.

def MyFunction():
  myModuleInstance = ?


Cheers!
-Brad
---
Unsubscribe? Mail Majordomo@Softimage.COM with the following text in body:
unsubscribe xsi



--
Aloys Baillet - XSI Technical Director
Character Dpt - Animal Logic
--

Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.