파이썬 3.2는 새로운 모듈 recursive_repr
을 reprlib
모듈에 도입했습니다. 내가 이해하지 못하는 것은 부트 스트랩 문제가 왜하지 @wraps(user_function)
이 wrapper
에 무엇을Functools의 "부트 스트랩 문제"가 장식자를 감싸고 있습니까?
def recursive_repr(fillvalue='...'):
'Decorator to make a repr function return fillvalue for a recursive call'
def decorating_function(user_function):
repr_running = set()
def wrapper(self):
key = id(self), get_ident()
if key in repr_running:
return fillvalue
repr_running.add(key)
try:
result = user_function(self)
finally:
repr_running.discard(key)
return result
# Can't use functools.wraps() here because of bootstrap issues
wrapper.__module__ = getattr(user_function, '__module__')
wrapper.__doc__ = getattr(user_function, '__doc__')
wrapper.__name__ = getattr(user_function, '__name__')
wrapper.__annotations__ = getattr(user_function, '__annotations__', {})
return wrapper
return decorating_function
을 적용 할 수있다있다 : 나는 source code으로 보았을 때이 코드를 발견
?