On Sat, Nov 30, 2019 at 11:13:54PM -0500, Wes Turner wrote:
> Does functools.update_wrapper() *copy* __doc__ and __annotations__ or
> *reference* those function/method attributes so that the API docs have the
> docstrings and tools with type annotation support have the correct type
> annotations?
> https://docs.python.org/3/library/functools.html#functools.update_wrapper
Right at the top of the page is a link to the source code, so you ought
to be able to tell from reading the source, which is in Python.
I would expect that since __doc__ is a string or None, and in both cases
immutable, copying it would be a waste of time. (And impossible in the
case of None.) I'm gratified to see from the source that I'm correct:
update_wrapper calls:
setattr(wrapper, attr, value)
not
setattr(wrapper, attr, copy.copy(value))
or similar. Does that answer your question? If I have misunderstood your
question, please clarify.
--
Steven
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/LDTTQQLNHTLABSLK74ROJ3A3426QOJLV/
Code of Conduct: http://python.org/psf/codeofconduct/