Message83444
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 |
|
Date |
User |
Action |
Args |
2009-03-10 19:13:31 | bmiller | set | recipients:
+ bmiller, loewis, rhettinger, amaury.forgeotdarc, belopolsky, benjamin.peterson, aclover |
2009-03-10 19:13:31 | bmiller | set | messageid: <1236712411.25.0.872775464312.issue2610@psf.upfronthosting.co.za> |
2009-03-10 19:13:29 | bmiller | link | issue2610 messages |
2009-03-10 19:13:27 | bmiller | create | |
|