Skip to content

Commit

Permalink
A more informative error message when you try to edit a row's content…
Browse files Browse the repository at this point in the history
…s. For wireservice#499.
  • Loading branch information
palewire committed Feb 18, 2016
1 parent 64c453f commit 0893232
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions agate/mapped_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ def __getitem__(self, key):
else:
return self.dict()[key]

def __setitem__(self, key, value):
"""
Set values by index, which we want to fail loudly.
"""
raise TypeError("Rows are read only and do not support item \
assignment. Rather that overwrite your existing data, you could create a \
new column based on its contents. Learn how here: \
http://agate.readthedocs.org/en/latest/tutorial.html#computing-new-columns")

def __iter__(self):
"""
Iterate over values.
Expand Down

0 comments on commit 0893232

Please sign in to comment.