[issue13224] Change str(x) to return only __qualname__ for some types
Éric Araujo mer...@netwok.org added the comment: You are right, I misinterpreted “use”. I cloned the the PEP 3155 repo and ran my test script (I’ll attach it for reference) and reprs/strs are indeed class '__main__.A.B' and function makestrip.locals.strip at ..., so this request is not obsoleted. I’ve updated my patch to use qualnames for str(cls) and str(func). As I reported before, if I want str(sys.exc_info) to be 'exc_info', then Python unbound methods (i.e. functions) are affected: method 'update' of 'dict' objects built-in method update of dict object at ... method 'tolist' of 'array.array' objects built-in method tolist of array.array object at ... → Counter.update bound method Counter.update of Counter() → Top.Nested.method # this checks qualnames are used bound method Nested.method of __main__.Top.Nested object at ... It seems to me that this is not a problem: Python 3 unbound methods *are* functions. If you decide that having str(method) unchanged for all kinds of methods is more important than giving all kinds of functions a short str, I can do it. -- dependencies: +PEP 3155 implementation Added file: http://bugs.python.org/file23771/change-some-str.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13224 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13224] Change str(x) to return only __qualname__ for some types
Changes by Éric Araujo mer...@netwok.org: Added file: http://bugs.python.org/file23772/test-str-repr.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13224 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13224] Change str(x) to return only __qualname__ for some types
Changes by Éric Araujo mer...@netwok.org: Removed file: http://bugs.python.org/file23468/change-class-__str__.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13224 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13224] Change str(x) to return only __qualname__ for some types
Changes by Éric Araujo mer...@netwok.org: Removed file: http://bugs.python.org/file23591/change-some-__str__.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13224 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13224] Change str(x) to return only __qualname__ for some types
Éric Araujo mer...@netwok.org added the comment: PEP 3155 is accepted and makes str(cls) and str(function) as well as repr(cls) and repr(function) return the qualified name, which obsoletes part of this request. I haven’t checked if it has the same problem with Python methods. str(module) is not changed by the PEP. -- title: Change str(class) to return only the class name - Change str(x) to return only __qualname__ for some types ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13224 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13224] Change str(x) to return only __qualname__ for some types
Guido van Rossum gu...@python.org added the comment: Are you sure? The way I read the PEP, it just said that str(cls) and str(func) should *use* qualname. That could mean returning 'function f.g.h at 0x1234' or 'class '__main__.C.D'. On Tue, Nov 22, 2011 at 7:27 AM, Éric Araujo rep...@bugs.python.org wrote: Éric Araujo mer...@netwok.org added the comment: PEP 3155 is accepted and makes str(cls) and str(function) as well as repr(cls) and repr(function) return the qualified name, which obsoletes part of this request. I haven’t checked if it has the same problem with Python methods. str(module) is not changed by the PEP. -- title: Change str(class) to return only the class name - Change str(x) to return only __qualname__ for some types ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13224 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13224 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13224] Change str(x) to return only __qualname__ for some types
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13224 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com