nodes: 0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sortlist; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, if_statement; 15, if_statement; 16, return_statement; 17, identifier:name; 18, string; 19, identifier:limit; 20, integer:0; 21, identifier:offset; 22, integer:0; 23, identifier:style; 24, string; 25, comment:"""Sort the table and return the result as a reference table.
  
          This method sorts the table. It forms a
          `TaQL <../../doc/199.html>`_
          command from the given arguments and executes it using the
          :func:`taql` function.
          The result is returned in a so-called reference table which references
          the columns and rows in the original table. Usually a reference
          table is temporary, but it can be made persistent by giving it a name.
          Note that a reference table is handled as any table, thus can be
          queried again.
  
          `sortlist`
            The ORDERBY part of a TaQL command. It is a single string in which
            commas have to be used to separate sort keys. A sort key can be the
            name of a column, but it can be an expression as well.
          `name`
            The name of the reference table if it is to be made persistent.
          `limit`
            If > 0, maximum number of rows to be selected after the sort step.
            It can, for instance, be used to select the N highest values.
          `offset`
            If > 0, ignore the first `offset` matches after the sort step.
          `style`
            The TaQL syntax style to be used (defaults to Python).
  
          """; 26, assignment; 27, comparison_operator:limit > 0; 28, block; 29, comparison_operator:offset > 0; 30, block; 31, identifier:name; 32, block; 33, call; 34, string_content:Python; 35, identifier:command; 36, binary_operator:'select from $1 orderby ' + sortlist; 37, identifier:limit; 38, integer:0; 39, expression_statement; 40, identifier:offset; 41, integer:0; 42, expression_statement; 43, expression_statement; 44, identifier:tablecommand; 45, argument_list; 46, string; 47, identifier:sortlist; 48, augmented_assignment; 49, augmented_assignment; 50, augmented_assignment; 51, identifier:command; 52, identifier:style; 53, list; 54, string_content:select from $1 orderby; 55, identifier:command; 56, binary_operator:' limit %d' % limit; 57, identifier:command; 58, binary_operator:' offset %d' % offset; 59, identifier:command; 60, binary_operator:' giving ' + name; 61, identifier:self; 62, string; 63, identifier:limit; 64, string; 65, identifier:offset; 66, string; 67, identifier:name; 68, string_content:limit %d; 69, string_content:offset %d; 70, string_content:giving
code: def sort(self, sortlist, name='',
               limit=0, offset=0, style='Python'):
          """Sort the table and return the result as a reference table.
  
          This method sorts the table. It forms a
          `TaQL <../../doc/199.html>`_
          command from the given arguments and executes it using the
          :func:`taql` function.
          The result is returned in a so-called reference table which references
          the columns and rows in the original table. Usually a reference
          table is temporary, but it can be made persistent by giving it a name.
          Note that a reference table is handled as any table, thus can be
          queried again.
  
          `sortlist`
            The ORDERBY part of a TaQL command. It is a single string in which
            commas have to be used to separate sort keys. A sort key can be the
            name of a column, but it can be an expression as well.
          `name`
            The name of the reference table if it is to be made persistent.
          `limit`
            If > 0, maximum number of rows to be selected after the sort step.
            It can, for instance, be used to select the N highest values.
          `offset`
            If > 0, ignore the first `offset` matches after the sort step.
          `style`
            The TaQL syntax style to be used (defaults to Python).
  
          """
          command = 'select from $1 orderby ' + sortlist
          if limit > 0:
              command += ' limit %d' % limit
          if offset > 0:
              command += ' offset %d' % offset
          if name:
              command += ' giving ' + name
          return tablecommand(command, style, [self])