[GRASS-dev] temporal framework currently not working on windows

Glynn Clements glynn at gclements.plus.com
Thu Nov 27 09:59:59 PST 2014

Sören Gebbert wrote:

> > I would like to better understand, this point...
> > Why the decorator must_be_open  it seems to work so far?
> > which is the difference between @must_be_open[0] and @mdebug[1]?
> > Any Ideas?
> Unfortunately i have no idea. I did not found good information about
> when and how exactly these decorators are processed.
> So my guess was that (because of the backtrace) the decorator function
> is somehow analyzed at import time and the messenger process gets
> started.

A function used as a decorator is invoked when the decorated function
is defined, which is usually at import time.

The code:

	def foo():

is equivalent to

	def foo():
	foo = decorator(foo)

Whether this poses a problem depends upon exactly *what* the decorator

Typical decorators simply return a closure, i.e. a local function
which, when called, calls the function being decorated. This situation
is usually harmless, as nothing significant happens until the
decorated function is actually invoked.

As a general rule, modules shouldn't do anything substantial on
import. If you're using decorators, this typically means that the
decorators shouldn't do anything substantial, as they'll be called on
import. Any work should be deferred until the decorated function is
called (i.e. it goes inside the local function, not in the body of the

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list