From dab6e4e52a3b98a82dd74257c7a64164ce2cc674 2007-08-22 20:43:34 From: vivainio Date: 2007-08-22 20:43:34 Subject: [PATCH] SList pretty printer - now 'a = !ls; a' prints indices --- diff --git a/IPython/genutils.py b/IPython/genutils.py index 1f0ad54..4edda89 100644 --- a/IPython/genutils.py +++ b/IPython/genutils.py @@ -5,7 +5,7 @@ General purpose utilities. This is a grab-bag of stuff I find useful in most programs I write. Some of these things are also convenient when working at the command line. -$Id: genutils.py 2659 2007-08-22 20:21:07Z vivainio $""" +$Id: genutils.py 2661 2007-08-22 20:43:34Z vivainio $""" #***************************************************************************** # Copyright (C) 2001-2006 Fernando Perez. @@ -1008,6 +1008,15 @@ class SList(list): p = paths = property(get_paths) +def print_slist(arg): + """ Prettier (non-repr-like) and more informative printer for SList """ + print "SList (.p, .n, .l, .s available). Value:" + nlprint(arg) + +print_slist = result_display.when_type(SList)(print_slist) + + + #---------------------------------------------------------------------------- def esc_quotes(strng): """Return the input string with single and double quotes escaped out"""