From 3992dac3e4758aa97a93cb9be58cef03e30f366f Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Wed, 5 Dec 2018 02:22:06 +0100 Subject: [PATCH] Simplify argument checking in Table.__getitem__. This just lets the exception, if any, propagate out of `dict.__getitem__`; this avoids e.g. `Table[a, b, c]` silently "working" by silently dropping the third argument. --- lib/matplotlib/table.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/table.py b/lib/matplotlib/table.py index 0a2121a127df..6503d3027549 100644 --- a/lib/matplotlib/table.py +++ b/lib/matplotlib/table.py @@ -350,14 +350,8 @@ def __setitem__(self, position, cell): self.stale = True def __getitem__(self, position): - """ - Retrieve a custom cell from a given position. - """ - try: - row, col = position[0], position[1] - except Exception: - raise KeyError('Only tuples length 2 are accepted as coordinates') - return self._cells[row, col] + """Retrieve a custom cell from a given position.""" + return self._cells[position] @property def edges(self):