All pastes #395686 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-03-15 06:40 UTC
rendered paste body
class NeedsChildren(object):
   """Decorator you use to specify whether a subclass method requires
   this TreeObject to renumerate the childen.
   
   This is done so the children of a given tree object may be lazily
   evaluated.
   """
   
   def __init__(self, f):
      self.__f = f

   def __call__(self, *args, **kwargs):
      args[0].need_children()
      return self.__f(*args, **kwargs)