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 vstinner
Recipients chris.jerdonek, hongweipeng, serhiy.storchaka, vstinner, xtreak
Date 2018-10-18.21:21:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1539897711.95.0.788709270274.issue34475@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-10-18 21:21:51vstinnersetrecipients: + vstinner, chris.jerdonek, serhiy.storchaka, hongweipeng, xtreak
2018-10-18 21:21:51vstinnersetmessageid: <1539897711.95.0.788709270274.issue34475@psf.upfronthosting.co.za>
2018-10-18 21:21:51vstinnerlinkissue34475 messages
2018-10-18 21:21:51vstinnercreate