Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

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.

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33790>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to