Darren Dale wrote: [...] > Why do we need a single namespace? It seems unadvisable. There is additional > overhead with namespace lookups: running numpy.arange(10) a million times > takes 15% longer than arange(10). I would have thought it best to do more > of "from w import x, y, z"
I have indeed been concerned about this performance aspect, and it was a consideration in dropping the mpl namespace. John's original prescription ("import matplotlib.lines as lines") was very close to what we eventually converged on ("from matplotlib import lines as mlines"), but we will still be doing more namespace lookups now than we were before numpification. The advantage is fewer clashes and clearer code; I won't have to rack my brains to try to remember (or pause to go to the top of the file to look) where a given function came from; the disadvantages are the extra lookups, and the increased difficulty in keeping code compact, concise, and nicely formatted. I have come around to the view that for the most part, the advantages outweigh the disadvantages, and we have a reasonable compromise; but as John mentioned in our weekend discussions, we might want to make exceptions--so long as we don't end up with more exceptions than rule-followers. Maybe the thing to do is to make exceptions sparingly where it looks like there is a substantial benefit, either for performance or for readability. In practice, I expect that the penalty for the extra lookups will be negligible in almost every case. Eric ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel