##// END OF EJS Templates
add examples to SList.grep doc
vivainio -
Show More
@@ -5,7 +5,7 b' General purpose utilities.'
5 5 This is a grab-bag of stuff I find useful in most programs I write. Some of
6 6 these things are also convenient when working at the command line.
7 7
8 $Id: genutils.py 2726 2007-09-07 15:07:17Z vivainio $"""
8 $Id: genutils.py 2727 2007-09-07 15:32:08Z vivainio $"""
9 9
10 10 #*****************************************************************************
11 11 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
@@ -1013,6 +1013,11 b' class SList(list):'
1013 1013
1014 1014 This is case-insensitive. If prune is true, return all items
1015 1015 NOT matching the pattern.
1016
1017 Examples::
1018
1019 a.grep( lambda x: x.startswith('C') )
1020 a.grep('Cha.*log', prune=1)
1016 1021 """
1017 1022 if isinstance(pattern, basestring):
1018 1023 pred = lambda x : re.search(pattern, x, re.IGNORECASE)
General Comments 0
You need to be logged in to leave comments. Login now