Using a dict as if it were a module namespace

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Mon Jan 28 03:09:45 EST 2008


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 myfunc, test"""

Ah, also good thinking! I'd have to modify it, because the tests carry 
other information which shouldn't be passed to the test function, but 
that's a simple modification.

Thanks to all who replied.


-- 
Steven



More information about the Python-list mailing list