From: John H. <jdh...@ac...> - 2004-12-13 20:52:43
|
>>>>> "Ted" == Ted Drain <ted...@jp...> writes: Ted> John, I think the push/pop functions are going to be fairly Ted> useful (ipush and ipop??). We're going to be writing a lot Ted> scripts (i.e. functions) that generate plots for our users. Ted> There is no way to tell inside the script if it's going to be Ted> used by a user in interactive mode or by another script (like Ted> a batch report generator). Having push/pop would let me do: Ted> def stdPlot( [inputs] ): ipush( False ) try: [ create plot ] Ted> finally: ipop() Ted> Of course it's pretty easy to roll your own but I think it Ted> would be nice to have it in the standard set of commands. Hi Ted, I hadn't thought of using a stack. What is the argument for a stack as opposed to a single state manipulated along the lines of (with try except as needed) b = isinteractive() ioff() ....your plot here... if b: ion() Your approach requires one fewer line of code. Are their other advantages to a stack approach? I think a stack may be slightly less intuitive to a typical user, whereas turning drawing mode on and off is fairly straight forward. JDH |