Well I don't think that it would really require that. I could just define macro's in a module and just do it like so
import macro import defined_macros as m macro.expand(m.with(),m.assert()) I just thought it would be best to have definitions at the head of a script, or at least to have the option. Jeff Shannon wrote: > Perhaps you could turn things around, and make your macro preprocessor > into an import hook? I.E., you'd use it like -- > > import macro > module = macro.import("module_with_macros"[, macro_list]) > module.do_stuff() > > Not sure if you'd need to have a list of macros in the module to be > imported, or not. Perhaps the macro module would hold a list of > currently active macros, instead... > > In any case, this (I think) gives you a chance to interrupt the import > process and modify the target module before the Python parser gets it, > which should enable you to avoid the SyntaxError problems. > > (Of course, I've never messed around with hooking __import__(), so I > could just be talking out of my ...) > > __________________________________ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250 _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor