Torsten Bronger wrote:
def generate_type_dublett(visa_type, ctypes_type): visa_type_name = visa_type.__name__ exec visa_type_name + "=" + ctypes_type.__name__ exec "ViP" + visa_type_name[2:] + "=POINTER(" + visa_type_name + ")"
You shouldn't need to use exec for this, and it is best to avoid its use.
If you MUST do things this way, then you can add items to the globals() dictionary. See the library reference for more details. It's probably best to avoid globals() as well, although it's not as bad as exec/eval.
Personally, I think it would be better to define your types like this:
ViUInt32, ViPUInt32, ViAUInt32 = generate_type_triplet(u_long)
That way you will easily be able to find the initial definition of the object by searching and replacing. You'll also have to jump through fewer weird hoops to get the result you want. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list