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 aclover
Recipients aclover, amaury.forgeotdarc, belopolsky, benjamin.peterson, bmiller, loewis, rhettinger
Date 2008-11-12.20:37:00
SpamBayes Score 3.8857806e-16
Marked as misclassified No
Message-id <1226522222.24.0.952879518163.issue2610@psf.upfronthosting.co.za>
In-reply-to
Content
I would like to see something along the general lines of bmiller's patch
for dict views in a 3.x release... there are probably other iterators
that could do with chattier reprs also. (Range, on the other hand, is
fine as it is.)

It's not just at the interactive prompt that good reprs are useful, it's
also in debugging: debug-prints in scripts in general, web application
error pages that dump variable information, error detail logging to a
database for inspection long after the ability to inspect the value has
passed, and so on.

I think it's better to put the feature in repr than require all these
things - everything that might want to display values helpfully - to
implement detection and prettification for specific iterators.

Sure, you can apply list() if you know in advance you're going to need
to, but for beginners and debuggers getting the information out there
without having to ask for it is a real win. I certainly remember how
pleasantly surprised I was when learning Python 1.something and finding
it just told me what I wanted to know without having to ask for it - in
contrast to previous tedious languages that only ever said 'object' or
'[Array]'...

I can't really think of any advantage to having repr keep that
information hidden.
History
Date User Action Args
2008-11-12 20:37:02acloversetrecipients: + aclover, loewis, rhettinger, amaury.forgeotdarc, belopolsky, benjamin.peterson, bmiller
2008-11-12 20:37:02acloversetmessageid: <1226522222.24.0.952879518163.issue2610@psf.upfronthosting.co.za>
2008-11-12 20:37:01acloverlinkissue2610 messages
2008-11-12 20:37:00aclovercreate