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 stribb
Recipients stribb
Date 2008-10-13.11:45:13
SpamBayes Score 1.5515006e-06
Marked as misclassified No
Message-id <1223898315.71.0.950281538816.issue4113@psf.upfronthosting.co.za>
In-reply-to
Content
When I partially apply a function using functools.partial(), the
resultant function doesn't have the same name as the original function
(it has no __name__) and its docstring is that of functools.partial()
rather than that of the function that was partially applied.

Transcript:

Python 2.6 (r26:66714, Oct 13 2008, 10:32:02)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>> import functools
>>> def sum(a,b,c):
...   return a+b+c
...
>>> functools.partial(sum,1)
<functools.partial object at 0xf7efeb6c>
>>> p = functools.partial(sum, 1)
>>> p.__name__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'functools.partial' object has no attribute '__name__'
>>> p(2,3)
6
>>> sum.__name__
'sum'
>>> sum.__doc__
>>> p.__doc__
'partial(func, *args, **keywords) - new function with partial
application\n\tof the given arguments and keywords.\n'
History
Date User Action Args
2008-10-13 11:45:15stribbsetrecipients: + stribb
2008-10-13 11:45:15stribbsetmessageid: <1223898315.71.0.950281538816.issue4113@psf.upfronthosting.co.za>
2008-10-13 11:45:14stribblinkissue4113 messages
2008-10-13 11:45:13stribbcreate