From: John H. <jdh...@ac...> - 2005-01-24 15:15:55
|
>>>>> "Norbert" == Norbert Nemec <Nor...@gm...> writes: Norbert> What about pulling all the plotting routines into a Norbert> separate file that can be included by anyone who just Norbert> wants the comfortable plotting commands without all the Norbert> other namespace cluttering. pylab itself would then only Norbert> contain lots of imports and all the namespace mangling. I think this is a good idea, especially since is a natural way to do it with the existing organization that shouldn't break much code. We already have the two modules in place: matplotlib.pylab and pylab. The former would just export the plotting symbols defined therein and the latter would be the namespace aggregator. Thus pylab.__all__ would be just as it is with 0.71 (plotting, numerix, mlab, matplotlib.dates symbols, matplotlib.ticker symbols, some colormapping stuff) and matplotlib.pylab.__all__ would only be the plotting commands. Scripts which currently do from pylab import * would be unaffected. There are some scripts which would be affected by these changes for those who eschew 'import *'. If you are getting the DateFormatter from pylab, you'll have to get it from matplotlib.dates instead. Basically, this would primarily affect people who are using custom tick locators or date locators/formatters. Of course, matplotlib.pylab *could* continue to provide these, but that seems to defeat the purpose of the change, which is to be more rigorous about exported namespaces. So the two questions are: 1) are people in favor of this change? and 2) if so, what should matplotlib.pylab export? Only symbols defined therein? Or perhaps add a few for backward compatibility? Specifically I'm wondering if matplotlib.pylab should continue to export: cm.jet, cm.gray, etc, date2num, num2date, drange, and perhaps the *Locator and *Formatter symbols from matplotlib.ticker and matplotlib.dates? I don't suppose it's possible to "warn on import", eg warning "matplotlib.pylab import of date2num is deprecated, please use matplotlib.dates instead". One could write wrappers for this, I know, but is there some import wizardry which supports this? JDH |