Sets an item or row in the matrix. For Datasheet[i] = v, sets the row at index i to v. For Datasheet[i,j] = v, sets the value in row i and column j to v.
(self, index, value)
| 1711 | raise AttributeError, "'Datasheet' object has no attribute '%s'" % k |
| 1712 | |
| 1713 | def __setitem__(self, index, value): |
| 1714 | """ Sets an item or row in the matrix. |
| 1715 | For Datasheet[i] = v, sets the row at index i to v. |
| 1716 | For Datasheet[i,j] = v, sets the value in row i and column j to v. |
| 1717 | """ |
| 1718 | if isinstance(index, tuple): |
| 1719 | list.__getitem__(self, index[0])[index[1]] = value |
| 1720 | elif isinstance(index, int): |
| 1721 | self.pop(index) |
| 1722 | self.insert(index, value) |
| 1723 | else: |
| 1724 | raise TypeError, "Datasheet indices must be int or tuple" |
| 1725 | |
| 1726 | def __getitem__(self, index): |
| 1727 | """ Returns an item, row or slice from the matrix. |
no test coverage detected