And Clover <[EMAIL PROTECTED]> added the comment: 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. ---------- nosy: +aclover _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2610> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com