From: Andrew S. <str...@as...> - 2005-01-20 20:41:12
|
OK, let's get this straight. The situation as it stands: Currently in CVS is an implementation such that "from pylab import *" does not override builtins. I think we all agree that this is the right behavior. The question is now the implementation. (The code I checked in simply restores of pylab's names to the builtins. e.g. in the pylab.py: "min = __builtin__.min") John suggests moving my "solution" (I prefer to think of it as a band-aid, curing the symptom, but not the cause) up the chain to numerix, such that numerix.min = __builtin__.min (same for max, etc). Additionally, he suggests bringing a few more names into existence such that numerix.nxmin = mlab.min (same again for max, etc). I have no problem with this, but Todd "we should keep numerix compatible with Numeric" Miller does, and I can see he has a valid point. Thus, I see no easy resolution which is of little consequence to those of us who do not use numerix in our code. Since I am personally quite busy with other stuff, and I don't see a clear consensus of this numerix issue, which is secondary to my initial gripe regarding pylab. I am disinclined to do anything more at this point. I will hereby let someone who cares more than I do about numerix take it from here. For the record, I agree with everyone that "from blah import *" is a bad idea. However, pylab is special and thus deserves special attention. Partly this is because John, Fernando, and others have spent many hours making sure it plays well in IPython, resulting in IPython's pylab mode being the best Python interactive scientific plotting solution. Personally, I agree with Fernando's decision to do a "from pylab import *" in ipython -pylab because it enables rapid, interactive data exploration. (Besides which, it freakin' rocks!! :) Given ipython -pylab is my most frequently used interactive Python, I want min/max/etc to be the builtin functions (especially since I tend to do "run -i blah.py" from IPython a lot, which thus inherit names, including min and max, from ipython's interactive namespace). Also, I am still intrigued by Norbert's suggestion to change Python itself to eliminate this mess, but I don't have the time to deal with it. Furthermore, even if someone did step up to the plate, this is a longer term solution, and we'd still need a "band-aid" for the immediate term. Getting back to my day job now, Andrew |