Re: Decorators without function

2010-08-09 Thread Gregory Ewing
Vedran wrote: @plot_decorator(fig_params1) def plt(): pylab.plot(..first graph data...) pylab.plot(..second graph data..) plt() You could do something like def call(f): f() @call @plot_decorator(fig_params1) def plt(): pylab.plot(..first graph data...)

Re: Decorators without function

2010-08-09 Thread Peter Otten
Vedran wrote: > Hello! > > Is it possible to apply a decorator on a block of code, without defining > a function that decorator is applied to. You can only decorate functions or classes. > I have to generate a lot of similar graphs. For that reason I use > plot_decorator to perform usual figur