From: Eric F. <ef...@ha...> - 2010-03-21 18:31:07
|
Ryan May wrote: > On Sun, Mar 21, 2010 at 12:35 PM, Jae-Joon Lee <lee...@gm...> wrote: >> On Sat, Mar 20, 2010 at 8:40 PM, Eric Firing <ef...@ha...> wrote: >>>> Or, how about we make axes an context manager. >>> This would require dropping support for Python 2.4. >> I don't think making the Axes a context manager means dropping python >> 2.4 support >> (note that I'm not saying we use "with" statement in the mpl source). >> Everything should work fine in python 2.4 (please correct me if I'm wrong). >> It just gives a user a choice. If a user runs his/her script with >> python 2.5 and higher, he/she has an option to use an axes as an >> context manager. Of course, if he/she want his/her own code supported >> in python 2.4, he/she should not use "with" statement. > > I see what you're saying. While the use of the language syntax is > restricted to 2.5 and above, we could add the needed methods to the > Axes object, which would just be ignored by python <2.5. That's not a > bad idea. > > I'm +1 on the idea. Is the added complexity, scrambling pylab into the OO layer, and need for explanation, really worth the gain? As far as I can see, it merely adds one more way to do something--and not a particularly recommended way. It is no more concise than using sca(). It may be slightly more readable because of the indentation, but that is the only advantage I see. Eric > > Ryan > |