Hi, Thanks for your opinion on this. I looked at
> def f(): > from pylab import * ... > savefig('test.png') before, but didn't liked the warning - also wondered about other proposed way: > pylab_mode() ... > pylab_mode(False) but it looked really fake to me. I liked the "with" approach, not too much of extra typing > with pylab: ... I made test implementation and it works (including rewritten show method to automatically number pictures as pylab_<n>.png), but I noticed one thing - is it intended behaviour in Sage Notebook that when using any "with", output of all lines are aired to output cell, while when not using "with" only output of last cell is aired to output cell? It makes lots of noise when plotting (matplotlib objects), unless someone assigns those to dummy variables - other solution would be writing bridge functions calling pylab functions to draw, but not returning the graphics primitives. Anyway it is like in: class test_controlled: def __enter__(self): True def __exit__(self,*arg): True test = test_controlled() where with test: 2+2 3+3 gives 4 6 but in normal cell entering 2+2 3+3 gives 6 If it's intended, it's OK too because that way one can plot multiple plots in one "with" cell - maybe I will silent the graphics calls only to hide the noise with informations about matplotlib objects. I haven't tried the proposed decorator way yet, because it forces closing whole code in function and adds 3 lines instead of one (2 in definition, one to call and gather output) - it also requires manually returning all that is defined inside and could be used in other places, while in "with" approach, if "a=zeros(3)" is assigned inside, then it is visible in other cells without changes. Generally "with" looked more lightweight to me. Thanks, Andrzej. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org