[issue4113] Add custom __repr__ to functools.partial

2010-12-01 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Let me close this issue before any serious bikeshedding begins. We can always reconsider when users complain that eval(repr(x)) does not work for their partial objects. -- status: open -> closed ___ Python t

[issue4113] Add custom __repr__ to functools.partial

2010-12-01 Thread Éric Araujo
Éric Araujo added the comment: I think the main purpose of repr is debugging, so I’d favor the unambiguous form (with the id) to the nice-looking one (module.name). -- ___ Python tracker __

[issue4113] Add custom __repr__ to functools.partial

2010-12-01 Thread Terry J. Reedy
Terry J. Reedy added the comment: I would prefer the module.name without the repr decoration. -- status: pending -> open ___ Python tracker ___ __

[issue4113] Add custom __repr__ to functools.partial

2010-12-01 Thread Alexander Belopolsky
Alexander Belopolsky 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 apr

[issue4113] Add custom __repr__ to functools.partial

2010-11-19 Thread Daniel Urban
Daniel Urban added the comment: Well, of course it can be done with PyUnicode_Concat (obviously, since PyUnicode_AppendAndDel uses that). I used PyUnicode_AppendAndDel because that function does exactly what I needed. I don't see why PyUnicode_AppendAndDel should be deprecated. Anyway, here i

[issue4113] Add custom __repr__ to functools.partial

2010-11-19 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: There is an ongoing discussion about deprecating undocumented PyUnicode_AppendAndDel(). See Marc-Andre's comment in msg121371: """ +.. c:function:: void PyUnicode_Append(PyObject **pleft, PyObject *right) + + Concat two strings and put the result in *p

[issue4113] Add custom __repr__ to functools.partial

2010-11-19 Thread Daniel Urban
Daniel Urban added the comment: Here is a patch. It includes tests. -- keywords: +patch nosy: +durban Added file: http://bugs.python.org/file19637/issue4113.diff ___ Python tracker _

[issue4113] Add custom __repr__ to functools.partial

2010-11-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Looks like a reasonable proposal, but coding this in C is a chore. It's not that bad. Most C code is a bit of a chore compared to Python but it really doesn't take much to write a C equivalent of: "functools.partial(%r, %s)" % (self.func, ', '.join(rep

[issue4113] Add custom __repr__ to functools.partial

2010-11-17 Thread Éric Araujo
Éric Araujo added the comment: One function in inspect can do everything we want, only not in C. How hard/inefficient would it be to have 99% of partial coded in C and one stub in functools.py? -- nosy: +eric.araujo, rhettinger ___ Python tracker

[issue4113] Add custom __repr__ to functools.partial

2010-06-10 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- versions: +Python 3.2 -Python 2.7, Python 3.1 ___ Python tracker ___ ___ Python-bugs-list mailing

[issue4113] Add custom __repr__ to functools.partial

2010-06-10 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I understand that the latest RFE in this issue is to provide a custom __repr__ to functools.partial. Something along the lines of class partial(functools.partial): def __repr__(self): return "functools.partial(%r, %s)" % (self.func,