call once for member function (i.e. takes self as first arg)

def meth_once(f):
  "call once for member function (i.e. takes self as first arg)"
  attr = '__meth_once_'+f.__name__
  @functools.wraps(f)
  def f2(self,*args,**kwargs):
    if hasattr(self,attr): raise CallOnceError(f.__name__)
    setattr(self,attr,True)
    return f(self,*args,**kwargs)
  return f2