Movatterモバイル変換


[0]ホーム

URL:


[Python-ideas] __repr__: to support pprint

qhlonlineqhlonline 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.7Regards!At 2017-03-01 06:59:52, "语言破碎处" <mlet_it_bew at 126.com> wrote:Hi, everyone!Oftenly, __repr__ return "{type}({args}, {kws})"problem:    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...)solution:allow __repr__ to return    str    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-ideasmailing list

[8]ページ先頭

©2009-2026 Movatter.jp