Author Jelle Zijlstra
Recipients Jelle Zijlstra, Thor Whalen, Thor Whalen2, domdfcoding, donovick, gregory.p.smith, ncoghlan, terry.reedy
Date 2021-05-02.03:52:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619927557.79.0.893728150137.issue41232@roundup.psfhosted.org>
In-reply-to
Content
We should not do this, because the wrapping function may have different defaults, and updating __defaults__ would make it use the wrapped function's defaults.

Example:

>>> def f(y=1):
...     print(y)
... 
>>> f()
1
>>> f.__defaults__
(1,)
>>> f.__defaults__ = ()
>>> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() missing 1 required positional argument: 'y'
History
Date User Action Args
2021-05-02 03:52:37Jelle Zijlstrasetrecipients: + Jelle Zijlstra, terry.reedy, gregory.p.smith, ncoghlan, donovick, Thor Whalen, Thor Whalen2, domdfcoding
2021-05-02 03:52:37Jelle Zijlstrasetmessageid: <1619927557.79.0.893728150137.issue41232@roundup.psfhosted.org>
2021-05-02 03:52:37Jelle Zijlstralinkissue41232 messages
2021-05-02 03:52:37Jelle Zijlstracreate