[Python-ideas] __repr__: to support pprint

qhlonline qhlonline at 163.com
Tue Feb 28 20:18:29 EST 2017

Yes, We are both python users with languages  OTHER then English,  It is a headache when looking at the print output of dicts with other language encoding. They are just byte array.  I am using python2.7


At 2017-03-01 06:59:52, "语言破碎处" <mlet_it_bew at 126.com> wrote:

Hi, everyone!
Oftenly, __repr__ return "{type}({args}, {kws})"
    1) to call .format() myself is tedious
        I have seen someone do it wrong: "T(1,)"!
        I write a helper function myself,
            but to import such tiny function everywhere isnot good.
    2) pprint cannot dive into string that from repr()
        To use pprint, I sometimes have to recursively
            turn objects into builtin containers:
            (type_name, args...)

allow __repr__ to return
    OR tuple: (args, kws)

Better, isn't it?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170301/d4253ef8/attachment.html>

More information about the Python-ideas mailing list