homepage

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 ncoghlan
Recipients eric.araujo, eric.snow, ezio.melotti, gvanrossum, martin.panter, ncoghlan, pitrou, rbcollins, serhiy.storchaka, veky, vstinner
Date 2017年09月19日.07:53:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1505807590.68.0.757323841594.issue13224@psf.upfronthosting.co.za>
In-reply-to
Content
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 test_structures and test_xmlrpc show the kinds of error messages that the change is aimed at improving (and I think it does indeed improve them), it still requires the kind of test case change that is going to be awkward from projects spanning multiple distinct versions of CPython
- most of the other cases were for code that actually wanted the current formatting, and needed to be updated to explicitly request repr() (either by calling it directly, or by switching to !r or %r in a formatting string)
Perhaps a less disruptive way of tackling the problem with the verbosity of name access would be to add a new `getname()` builtin that understood how to get the names of various things (e.g. via `__class__`), and preferred __qualname__ to __name__ when both were available? Then Guido's original motivating example could be written as:
 print(f"{getname(err)}: {err}") # f-string
 print("{}: {}".format(getname(err), err) # str.format
 print("%s: %s" % (getname(err), err)) # printf-style
As a new builtin, it could be trivially added to cross-version compatibility libraries like six and python-future, whereas directly changing the behaviour of __str__ on the affected builtin types isn't really something that can be readily emulated on old versions.
History
Date User Action Args
2017年09月19日 07:53:10ncoghlansetrecipients: + ncoghlan, gvanrossum, pitrou, vstinner, rbcollins, ezio.melotti, eric.araujo, eric.snow, martin.panter, serhiy.storchaka, veky
2017年09月19日 07:53:10ncoghlansetmessageid: <1505807590.68.0.757323841594.issue13224@psf.upfronthosting.co.za>
2017年09月19日 07:53:10ncoghlanlinkissue13224 messages
2017年09月19日 07:53:10ncoghlancreate

AltStyle によって変換されたページ (->オリジナル) /