STINNER Victor <vstin...@redhat.com> added the comment:

functools.partial objects have no __qualname__ attribute, but they don't have a 
__name__ attribute neither.

$ python3
Python 3.6.6 (default, Jul 19 2018, 14:25:17) 
>>> import functools
>>> func=int
>>> p=functools.partial(func)
>>> p.__name__
AttributeError: 'functools.partial' object has no attribute '__name__'
>>> p.__qualname__
AttributeError: 'functools.partial' object has no attribute '__qualname__'
>>> repr(p)
"functools.partial(<class 'int'>)"

If you want to "inherit" the name of the "wrapped function", you may use: 
functools.update_wrapper().

I'm not sure that it's correct to inherit the name by default. 
functools.partial() creates a new function, so if it has a name, for me, it 
should be different.

I agree to close the issue, it's not a bug.

----------
nosy: +vstinner

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

Reply via email to