Re: Loading just in time

2008-07-11 Thread Ben Finney
Ross Ridge <[EMAIL PROTECTED]> writes: > D'Arcy J.M. Cain <[EMAIL PROTECTED]> 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): >

Re: Loading just in time

2008-07-11 Thread Ross Ridge
D'Arcy J.M. Cain <[EMAIL PROTECTED]> 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

Re: Loading just in time

2008-07-10 Thread Scott David Daniels
D'Arcy J.M. Cain wrote: I am trying to create a utility module that only loads functions when they are first called rather than loading everything. I have a bunch of files in my utility directory with individual methods and for each I have lines like this in __init__.py: def calc_tax(*arg, **na

Re: Loading just in time

2008-07-10 Thread Ben Finney
"D'Arcy J.M. Cain" <[EMAIL PROTECTED]> writes: > Performance optimization wasn't really my goal here. What I was > looking for was the ability to spread the functions around different > files to manage them better from a proggrammer's POV. Why not do that, then? Your functions should be organised

Re: Loading just in time

2008-07-10 Thread samwyse
On Jul 10, 9:45 am, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > I am trying to create a utility module that only loads functions when > they are first called rather than loading everything.  I have a bunch > of files in my utility directory with individual methods and for each I > have lines li

Re: Loading just in time

2008-07-10 Thread D'Arcy J.M. Cain
On Thu, 10 Jul 2008 11:03:10 -0500 Larry Bates <[EMAIL PROTECTED]> wrote: > D'Arcy J.M. Cain wrote: > > def calc_tax(*arg, **name): > > from calc_tax import calc_tax as _func_ > > calc_tax = _func_ > > return _func_(*arg, **name) > You are stuck in a futile battle called "premature opt

Re: Loading just in time

2008-07-10 Thread Larry Bates
D'Arcy J.M. Cain wrote: I am trying to create a utility module that only loads functions when they are first called rather than loading everything. I have a bunch of files in my utility directory with individual methods and for each I have lines like this in __init__.py: def calc_tax(*arg, **na

Loading just in time

2008-07-10 Thread D'Arcy J.M. Cain
I am trying to create a utility module that only loads functions when they are first called rather than loading everything. I have a bunch of files in my utility directory with individual methods and for each I have lines like this in __init__.py: def calc_tax(*arg, **name): from calc_tax imp