SourceForge logo
SourceForge logo
Menu

matplotlib-devel

From: Michael D. <md...@st...> - 2007年11月29日 20:30:38
There are some Gtk-specific functions at the bottom of mlab.py. It 
tries to "import gtk" and then will either define them or not.
On one of my recent profiling fests, I noticed that this "import gtk" 
(if gtk is installed, and running with some non-Gtk backend) accounts 
for between 1-2% of the total running time over all the examples in 
backend_driver.py. Not a huge amount, but it seems like it might be a 
good idea to avoid importing something as large as gtk unless we 
actually need to.
We can either import gtk "on demand", when one of these gtk-related 
functions is called, or perhaps better yet move this to another module, 
that would only be imported when needed. In light of recent 
pylab.py/mlab.py refactorings, are there any opinions on this?
Cheers,
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: John H. <jd...@gm...> - 2007年11月29日 20:42:47
On Nov 29, 2007 2:30 PM, Michael Droettboom <md...@st...> wrote:
> There are some Gtk-specific functions at the bottom of mlab.py. It
> tries to "import gtk" and then will either define them or not.
Ahh, I hadn't considered import time in the try/except block. In
light of this, we probably will want to put them in another module. I
was inclined to something like matplotlib.gui.gtktools, but tere is
an analogous problem with mlab.rec2excel which conditionally imports
pyExcelerator (you probably did not notice it in your timing since it
wasn't installed). Perhaps matplotlib.external or
matplotlib.optional as top-level packages for both (and related).
Something like
matplotlib.optional.exceltools
matplotlib.optional.gtktools
This will serve the dual purpose of cleaning mlab and making Jarrod's
job a bit easier when he decides what to bring over to scipy.
JDH
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /