[issue13224] Change str(x) to return only the qualname for some types

2017-09-19 Thread Guido van Rossum
Guido van Rossum added the comment: And thanks for working it through! It was a valuable exercise. -- ___ Python tracker ___

[issue13224] Change str(x) to return only the qualname for some types

2017-09-19 Thread Éric Araujo
Éric Araujo added the comment: Yeah, it was interesting to explore but there are significant drawbacks and not enough benefit. Thanks for the guidance all! -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___

[issue13224] Change str(x) to return only the qualname for some types

2017-09-19 Thread Guido van Rossum
Guido van Rossum added the comment: Given Nick's feedback (and imagining what this would do to some codebases I know) I think this idea is dead, sadly. A helper function just doesn't give enough value, so let's not pursue that (it's easy to write the helper you want, it's hard to agree on what

[issue13224] Change str(x) to return only the qualname for some types

2017-09-19 Thread Vedran Čačić
Vedran Čačić added the comment: getname sounds good, but is in fact very confusing. In most cases, what you'd actually want, and end up writing, is getname(type(x)), but we can't make it the default since for classes we would actually like x.__name__ directly. It seems you say the same with

[issue13224] Change str(x) to return only the qualname for some types

2017-09-19 Thread Nick Coghlan
Nick Coghlan added the comment: That said, bringing over my overall comment from the PR review: I think the number of additional changes needed in the test suite and the standard library highlights the compatibility restoration busy-work risks of actually making this change: - while

[issue13224] Change str(x) to return only the qualname for some types

2017-09-18 Thread Nick Coghlan
Nick Coghlan added the comment: Specifically this message, where the unwritten rationale is to offer behavioural consistency across the builtin types that know their own name and include it in their current repr() output: https://mail.python.org/pipermail/python-ideas/2011-October/012464.html

[issue13224] Change str(x) to return only the qualname for some types

2017-09-18 Thread Guido van Rossum
Guido van Rossum added the comment: For modules, __name__ is the fully-qualified name, and that's fine. But for classes and functions __name__ is just the "given name" from the syntax (whatever came after 'def' or 'class') and that's not fine -- for anything except builtins where we do this I

[issue13224] Change str(x) to return only the qualname for some types

2017-09-18 Thread Éric Araujo
Éric Araujo added the comment: (Nick and Guido! «My proposal is to make str(x) return x.__name__ for exactly these three types of objects: modules, classes, and functions.») -- ___ Python tracker

[issue13224] Change str(x) to return only the qualname for some types

2017-09-18 Thread Éric Araujo
Éric Araujo added the comment: Martin Panter > I’m a bit confused. In the current patch, the new type_str() function > appears to use the “qualname” (which I support), but some of the test > changes seem to contradict this, e.g.: > >>> C.foo(1) > -classmethod 1 > +classmethod C 1 C is a

[issue13224] Change str(x) to return only the qualname for some types

2017-09-15 Thread Vedran Čačić
Vedran Čačić added the comment: I'm very glad this is moving forward. Yes, types (classes) are most important, functions and modules not so much. The biggest use case for me is easier construction of sane error messages. In many cases, something like f'Got a {type(argument)}' should be

[issue13224] Change str(x) to return only the qualname for some types

2017-09-15 Thread Éric Araujo
Éric Araujo added the comment: I converted my patch to a PR. One use case mentioned on python-ideas was for reprs of PEP 384 types; need to hunt down where typing could benefit from the new str(class). The quote in my first message mentions printing err.__class__ rather than

[issue13224] Change str(x) to return only the qualname for some types

2017-09-15 Thread Éric Araujo
Changes by Éric Araujo : -- pull_requests: +3599 ___ Python tracker ___ ___

[issue13224] Change str(x) to return only the qualname for some types

2015-08-14 Thread Robert Collins
Robert Collins added the comment: Ok, so needs more work. Moving back to patch review. -- stage: commit review - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13224 ___

[issue13224] Change str(x) to return only the qualname for some types

2015-08-05 Thread Robert Collins
Changes by Robert Collins robe...@robertcollins.net: -- nosy: +rbcollins ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13224 ___ ___

[issue13224] Change str(x) to return only the qualname for some types

2015-08-05 Thread Robert Collins
Robert Collins added the comment: The patch is a little stale but it seems easy enough to fix up. I'll commit it tomorrowish in the absence of other discussion. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13224

[issue13224] Change str(x) to return only the qualname for some types

2015-08-05 Thread Martin Panter
Martin Panter added the comment: I’m a bit confused. In the current patch, the new type_str() function appears to use the “qualname” (which I support), but some of the test changes seem to contradict this, e.g.: C.foo(1) -classmethod class 'test.test_descrtut.C' 1 +classmethod C 1 Also, I

[issue13224] Change str(x) to return only the qualname for some types

2015-06-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Other discussion: http://comments.gmane.org/gmane.comp.python.ideas/32192 . -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13224