def domain_constructor(**b_kwargs):
 def deco(f):
  def wrapper(*args, **kwargs):
   if ('name' in b_kwargs):
    _b_kwargs = b_kwargs
   else:
    _b_kwargs = dict(b_kwargs, name=f.__name__)
   f_rval = f(*args, **kwargs)
   domain = Domain((lambda x: x), f_rval, **_b_kwargs)
   return domain
  wrapper.__name__ = f.__name__
  return wrapper
 return deco

def domain_constructor ( ** b_kwargs ) : def deco ( f ) : def wrapper ( * args , ** kwargs ) : if ( 'name' in b_kwargs ) : _b_kwargs = b_kwargs else : _b_kwargs = dict ( b_kwargs , name = f . __name__ ) f_rval = f ( * args , ** kwargs ) domain = Domain ( ( lambda x : x ) , f_rval , ** _b_kwargs ) return domain wrapper . __name__ = f . __name__ return wrapper return deco
decorate a function that returns a pyll expressions so that it becomes a domain instance instead of a function example: @domain_constructor def f: return {loss: hp .