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 ned.deily
Recipients Zero, ned.deily
Date 2014-07-11.19:59:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1405108789.78.0.0247967643165.issue21957@psf.upfronthosting.co.za>
In-reply-to
Content
I am not sure why the string reprs for FF and VT are not special-cased to \f and \v but they are not alone: \a (BEL) and \b (BS) are also not special-cased.  My guess is that it was for performance reasons but perhaps someone with a longer memory can comment.  As now implemented, supporting these special cases would add checks for each for every character being encoded, a critical path for many applications, and in most cases, CR, LF, and HT are much more likely to be encountered.  I also don't see where this behavior is documented anywhere but it goes back a long way, probably to the earliest days of Python and, in general, Python does not make any promises about which of any valid representations for particular characters will be used.  While, on the one hand, it would make some string reprs look cleaner, on the other hand there are downsides: the risks of breaking existing code that might depend on the long-standing behavior, the potential performance impact that would need to be measured and mitigated, and the cost to develop and test.  In balance, I think the risks outweigh any benefit so I think we should not pursue this change.  If others feel differently, feel free to reopen.  In any case, thanks for the suggestion.
History
Date User Action Args
2014-07-11 19:59:49ned.deilysetrecipients: + ned.deily, Zero
2014-07-11 19:59:49ned.deilysetmessageid: <1405108789.78.0.0247967643165.issue21957@psf.upfronthosting.co.za>
2014-07-11 19:59:49ned.deilylinkissue21957 messages
2014-07-11 19:59:49ned.deilycreate