Michael Urman wrote: > For in-module effect, maybe some special import could pull in a > compiler class instance used only for the current module, allowing its > build_xyz methods be replaced. > > from __ast__ import compiler > compiler.build_float = Decimal # on an instance, so no 'self' parameter > > If something like that sounds reasonable for usage, I'll start looking > into how it looks for implementation. (Probably a big ball of mud! And > sounds like it depends on the python-side interface to the ast - I've > lost track if that's solidified yet.) :)
I deliberately left out the in-module effect, because Python compiles the whole module before executing any of it. Having in-module code trying to hook activities that happen before hand is challenging to say the least (that said, 'from __future__ import ...' statements have a double life as normal code and compiler directives, so it's obviously not impossible) OTOH, if you can get something working for the compile/exec/__import__ use cases, then a metapath entry can be used to experiment with applying it auto-magically on module import (and poking around inside the module to figure out what modifications to make). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com