def fields(self, *fields):
if len(fields) == <NUM_LIT:0>:<EOL><INDENT>return [el.split() for el in self]<EOL><DEDENT>res = SList()<EOL>for el in [f.split() for f in self]:<EOL><INDENT>lineparts = []<EOL>for fd in fields:<EOL><INDENT>try:<EOL><INDENT>lineparts.append(el[fd])<EOL><DEDENT>except IndexError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if lineparts:<EOL><INDENT>res.append("<STR_LIT:U+0020>".join(lineparts))<EOL><DEDENT><DEDENT>return res<EOL>
Collect whitespace-separated fields from string list

        Allows quick awk-like usage of string lists.

        Example data (in var a, created by 'a = !ls -l')::
            -rwxrwxrwx  1 ville None      18 Dec 14  2006 ChangeLog
            drwxrwxrwx+ 6 ville None       0 Oct 24 18:05 IPython

        a.fields(0) is ['-rwxrwxrwx', 'drwxrwxrwx+']
        a.fields(1,0) is ['1 -rwxrwxrwx', '6 drwxrwxrwx+']
        (note the joining by space).
        a.fields(-1) is ['ChangeLog', 'IPython']

        IndexErrors are ignored.

        Without args, fields() just split()'s the strings.