On 7/20/07, Fernando Perez <[EMAIL PROTECTED]> wrote:
> On 7/20/07, Darren Dale <[EMAIL PROTECTED]> wrote:
>
> > > This should give you a very reasonable solution for what you wanted to do.
> >
> > Great! I'm surprised that this was possible.
>
> And actually easy, for once.
>
> > Im attaching a patch for the ipython1 sandbox, which adds configobj.py, 
> > moves
> > the ipython and mpl config code into their own .py files, and moves the test
> > code into mpltest.py and ipythontest.py.
>
> Great, thanks!  Committed as r2526.  Later we'll move configobj.py
> into ipython/externals, but for now it's OK to have it in, so it's
> nicely self-contained for people to test this while we settle on
> something long-term.

I also just (r2528) updated things to use a cleaner import convention:
I don't like importing things from modules *they* imported.  To
clarify:

planck[tconfig]> svn diff -r2527:2528 mpltest.py
Index: mpltest.py
===================================================================
--- mpltest.py  (revision 2527)
+++ mpltest.py  (revision 2528)
@@ -1,5 +1,11 @@
-from mplconfig import MPLConfig, ConfigManager, mkConfigObj
+# import/reload base modules for interactive testing/development
+import tconfig, mplconfig
+reload(tconfig)
+reload(mplconfig)

+from tconfig import ConfigManager, mkConfigObj
+from mplconfig import MPLConfig

The point is that instead of

-from mplconfig import MPLConfig, ConfigManager, mkConfigObj

I prefer:

+from tconfig import ConfigManager, mkConfigObj
+from mplconfig import MPLConfig

since ConfigManager and mkConfigObj really live in tconfig, I'm not
tying my top-level code to an implementation detail of an intermediate
module (what it imports and how it names it).  I mention this
explicitly just because I think it's a good bit of coding practice.

The reload tricks also allow me to continue running the top-level test
codes while mucking with the stuff underneath, and have changes make
their way through consistently.

Thanks again,

f

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to