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.
Created on 2002年01月17日 23:15 by barry, last changed 2022年04月10日 16:04 by admin. This issue is now closed.
Messages (3) | |||
---|---|---|---|
msg8832 - (view) | Author: Barry A. Warsaw (barry) * (Python committer) | Date: 2002年01月17日 23:15 | |
pprint.pprint() uses repr to display an object. However I think it's at least as likely that pretty printing would be used as a human debugging tool rather than for generating a string "which can be used as input to the interpreter". pprint.pprint() -- and PrettyPrinter.pprint() should optionally use str() to print a human readable representation of the object. |
|||
msg8833 - (view) | Author: Fred Drake (fdrake) (Python committer) | Date: 2002年04月02日 05:08 | |
Logged In: YES user_id=3066 The usefulness of str() seems questionable; if the issue is debugging, repr()-like presentation seems to make more sense. I do think the pretty-printer should be configurable (via subclassing at least). I've checked in an attempt to make it easier to change the machinery use, but I'm not sure this is really the right change. I'm closing the bug report as vague, but am interested in suggestions for improving the pprint module. |
|||
msg8834 - (view) | Author: Barry A. Warsaw (barry) * (Python committer) | Date: 2002年04月02日 05:15 | |
Logged In: YES user_id=12800 I'll make two points. First, the pprint module documentation should clearly state that repr() is used instead of str(). It seems vague to me. Second, perhaps we should add a pprint.sprint() to use str() instead of repr(). I don't think the class needs to be derivable, since other than str and repr, I can't think of what you'd want to pretty print about an object. :) |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022年04月10日 16:04:53 | admin | set | github: 35939 |
2002年01月17日 23:15:58 | barry | create |