Loading just in time

Ross Ridge rridge at csclub.uwaterloo.ca
Sat Jul 12 00:23:55 CEST 2008


D'Arcy J.M. Cain <darcy at druid.net> wrote:
>def calc_tax(*arg, **name):
>    from calc_tax import calc_tax as _func_
>    calc_tax = _func_
>    return _func_(*arg, **name)

This should do what you want:

	def calc_tax(*arg, **name):
		global calc_tax
		from calc_tax import calc_tax
		return calc_tax(*arg, **name)

I suspect though that the cost of importing a lot of little modules
won't be as bad as you might think.

					Ross Ridge

-- 
 l/  //	  Ross Ridge -- The Great HTMU
[oo][oo]  rridge at csclub.uwaterloo.ca
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //	  



More information about the Python-list mailing list