[issue4113] Add custom __repr__ to functools.partial

Alexander Belopolsky report at bugs.python.org
Wed Dec 1 21:07:26 CET 2010


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

I simplified the partial_repr() code in issue4113b.diff and committed as r86916.

I wonder, however, if for the common case of func being a named function, displaying func.__name__ or func.__module__ + '.' + func.__name__ in repr(partial) may be more apropriate than repr(f).

For example, 

functools.partial(f, 1, 2, 3, a=5, b={}, c='7')

instead of

functools.partial(<function f at 0x100592d98>, 1, 2, 3, a=5, b={}, c='7')

----------
resolution:  -> accepted
stage: needs patch -> committed/rejected
status: open -> pending

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4113>
_______________________________________


More information about the Python-bugs-list mailing list