This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients ssmeke, steven.daprano
Date 2018-06-07.06:15:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1528352134.16.0.592728768989.issue33790@psf.upfronthosting.co.za>
In-reply-to
Content
I think you have misunderstood where and when default arguments are assigned. When you call func() with no arguments, kwargs is empty, and it is correct that the output will be

-> Decorator: 

In the following line, you call the original function, f(), again with no arguments. Then, and ONLY then, is the default argument for foo applied. Only the innermost function "func" knows that there is a parameter called foo with the given default. Hence the next output is 

-> Func: wont print in the decorator

as that is applying the default.

So I think the behaviour is correct. It is certainly the behaviour I would expect, so unless I'm misunderstanding your bug report, I think this is working as designed.

I'm going to close this report now, but if you think I've misunderstood anything and want to reopen it with more details, please do so.
History
Date User Action Args
2018-06-07 06:15:34steven.dapranosetrecipients: + steven.daprano, ssmeke
2018-06-07 06:15:34steven.dapranosetmessageid: <1528352134.16.0.592728768989.issue33790@psf.upfronthosting.co.za>
2018-06-07 06:15:34steven.dapranolinkissue33790 messages
2018-06-07 06:15:33steven.dapranocreate