On Sun, 27 Jan 2008 10:04:06 -0500, Ross Ridge wrote:
I think this is the way to go as it follows the principle of say what
you mean. You can however simplify it, and repeat yourself less, by
using the extended call syntax:
expr = myfunc(**test)
setup = from __main__ import
On Sunday 27 January 2008 09:45, Steven D'Aprano wrote:
I have a problem which I think could be solved by using a dict as a
namespace, in a similar way that exec and eval do.
When using the timeit module, it is very inconvenient to have to define
functions as strings. A good
On Jan 27, 8:45 am, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
I have a problem which I think could be solved by using a dict as a
namespace, in a similar way that exec and eval do.
When using the timeit module, it is very inconvenient to have to define
functions as strings.
Steven D'Aprano writes:
(1) Import the test and grab the values needed from it:
setup = from __main__ import myfunc, test
x, y = test['x'], test['y']
I don't like this one. It doesn't seem very elegant to me, and it gets
unwieldy as the complexity increases. Every item I need from test has
Steven D'Aprano wrote:
I have a problem which I think could be solved by using a dict as a
namespace, in a similar way that exec and eval do.
When using the timeit module, it is very inconvenient to have to define
functions as strings. A good alternative is to create the function as
On Sun, 27 Jan 2008 11:16:00 -0700, Steven Bethard wrote:
Why not mess with the namespace inside the setup code? E.g.::
[snip]
Ah, thanks, good thinking. It's not perfect, but it should be close
enough for what I'm trying to do.
--
Steven
who still wishes you could explicitly pass a
I have a problem which I think could be solved by using a dict as a
namespace, in a similar way that exec and eval do.
When using the timeit module, it is very inconvenient to have to define
functions as strings. A good alternative is to create the function as
normal, and import it:
def