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 bmiller
Recipients aclover, amaury.forgeotdarc, belopolsky, benjamin.peterson, bmiller, loewis, rhettinger
Date 2009-03-10.19:13:27
SpamBayes Score 5.436299e-10
Marked as misclassified No
Message-id <1236712411.25.0.872775464312.issue2610@psf.upfronthosting.co.za>
In-reply-to
Content
Just to restart the discussion on the original issue since I see that 
the latest 3.1 has solved the problem with dict_keys, dict_values, etc 
al objects.  Many thanks!

A suggestion was made by Alexander to create a custom displayhook that 
could be included in the standard library.  From the research I've done 
it looks like a solution for range would be something like the 
following:

import sys
def eduhook(o):
    if o is None:
        return
    if isinstance(o,range):
        print(list(o))
    else:
        print(repr(o))
        
sys.displayhook = eduhook

Now if 5233/5234 were approved I could tell my students to setup an 
environment variable PYTHONSTARTUP that points to a file that imports a 
module containing the above code.  (or I could just tell them to import 
said module each time.)

The above hook appears to work fine.  Is there anything obvious I'm 
missing?  If this is along the right track then I could extend it to 
support other custom display ideas that my fellow educators have in 
mind.

Thanks,

Brad
History
Date User Action Args
2009-03-10 19:13:31bmillersetrecipients: + bmiller, loewis, rhettinger, amaury.forgeotdarc, belopolsky, benjamin.peterson, aclover
2009-03-10 19:13:31bmillersetmessageid: <1236712411.25.0.872775464312.issue2610@psf.upfronthosting.co.za>
2009-03-10 19:13:29bmillerlinkissue2610 messages
2009-03-10 19:13:27bmillercreate