def recursive_repr(func):
 repr_running = set()
 @wraps(func)
 def wrapper(self):
  key = (id(self), get_ident())
  if (key in repr_running):
   return '...'
  repr_running.add(key)
  try:
   return func(self)
  finally:
   repr_running.discard(key)
 return wrapper

def recursive_repr ( func ) : repr_running = set ( ) @ wraps ( func ) def wrapper ( self ) : key = ( id ( self ) , get_ident ( ) ) if ( key in repr_running ) : return '...' repr_running . add ( key ) try : return func ( self ) finally : repr_running . discard ( key ) return wrapper
decorator to make a repr function return fillvalue for a recursive call .