Question on class module import

monkeyboy fsenkel at lynx.neu.edu
Fri Dec 4 18:10:49 EST 2009


Hello,

I want to write a wrapper class around a windows dll. If I put the
class in a module "Refprop.py" then import the class where I want to
use it, does the whole module get read by the interpreter or just the
class code?...

For example if I say the following in "Refprop.py" does the code above
the class statement get run on an import or should the loadLibrary
call be made in the constructor...the code below appears to work OK, I
just want to be sure I understand what happens on an import call....

    from ctypes import *
    rp = windll.LoadLibrary("refprop.dll")

   class refprop():
        '''
       REFPORP class
        '''
       nc = c_long(1)
       ierr = c_long(0)
       ......





More information about the Python-list mailing list