def _getitem (self, key, nrows):
     sei = _check_key_slice (key, nrows, 'tablerow');
     rownr = sei[0];
     if len(sei) == 1:
         return self.get (rownr);
     result = [];
     inx = 0;
     while inx < sei[1]:
         result.append (self.get (rownr));
         rownr += sei[2];
         inx   += 1;
     return result;
 def __getitem__ (self, key):
     """Get the values from one or more rows."""
     sei = _check_key_slice (key, self._table.nrows(), 'tablecolumn');
     if len(sei) == 1:
         # A single row.
         return self.getcell (sei[0]);
     # Handle row by row and store values in a list.
     result = [];
     rownr  = sei[0];
     inx    = 0;
     while inx < sei[1]:
         result.append (self.getcell (rownr));
         rownr += sei[2];
         inx   += 1;
     return result;
 def _setitem (self, key, value, nrows):
     sei = _check_key_slice (key, nrows, 'tablerow');
     rownr = sei[0];
     if len(sei) == 1:
         return self.put (rownr, value);
     if isinstance(value, dict):
         # The same value is put in all rows.
         inx = 0;
         while inx < sei[1]:
             self.put (rownr, value, True);
             rownr += sei[2];
             inx   += 1;
     else:
         # Each row has its own value.
         if len(value) != sei[1]:
             raise RuntimeError("tablerow slice length differs from value length")
         for val in value:
             self.put (rownr, val, True);
             rownr += sei[2];
 def __setitem__ (self, key, value):
     sei = _check_key_slice (key, self._table.nrows(), 'tablecolumn');
     if len(sei) == 1:
         # A single row.
         return self.putcell (sei[0], value);
     # Handle row by row.
     rownr = sei[0];
     inx   = 0;
     if not (isinstance(value,list) or isinstance(value,tuple)):
         # The same value is put in all rows.
         while inx < sei[1]:
             self.putcell (rownr, value);
             rownr += sei[2];
             inx   += 1;
     else:
         # Each row has its own value.
         if len(value) != sei[1]:
             raise RuntimeError("tablecolumn slice length differs from value length")
         for val in value:
             self.putcell (rownr, val);
             rownr += sei[2];
     return True;