From: Chris B. <Chr...@no...> - 2005-01-20 17:42:40
|
As long as this is being discussed, I'll put in my $0.2 I think encouraging "import *" Is a BAD IDEA. Even for interactive use. Since I've used Python, the only time I've used import * is for Numeric, and now I've started using import Numeric as N. > Namespaces are one honking great idea -- let's do more of those! That's why I'm resistant to using import * Anyway, I'm very happy about matplotlib because it does most of what I need, does it well, works with wx and AGG, and is constantly being improved. However, even though I'm an old matlab fanatic, I'm not thrilled with the efforts to make matplotlib matlab-like. I have various reasons for using Python rather than matlab, but one of the primary ones is that I like the language better, and I like OO. Hence, I'd much rather have a platting package be pythonic than matlab-like. Name spaces and OO are a big part of this. Name spaces and an OO interface are very linked, by the way. The reason NumPy is commonly used with the import * approach is that there are a LOT of functions exposed, and we all get tired of typing Numeric. (or even N.). However, many of those functions should really be methods. I've always been confused by the Numeric docs, which suggest that the function interface is necessary so that you can do, for instance: B = Numeric.transpose(A) and A doesn't have to be a Numeric Array. This would be very cool if transpose (and many other ufuncs) returned the type that was input, but it doesn't, it returns an array, so it's really the equivalent of: B = array(A) B.transpose(B) if transpose were an array method. Is it really so onerous to type that extra line? I like the extra line, because it makes things clear to me what's going on. anyway, to cut my rant short, here is my vote for matplotlib development (not that I get a vote, but hopefully I'll have time to help out someday) 1) Deprecate "from pylab import *" 2) Improve the OO interface to make it just as easy to use. Even with improvements, I understand that it will be a little bit more awkward to use in interactive mode, but how much does anyone really do interactively anyway? Even with Matlab, I soon learned that if I'm typing more that 3 lines, I should put it in a script. I know we can do (2) without doing (1), but if (1) is what's in all the examples, it's going to get used. OK, enough of my rant. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |