Skip to content

Commit

Permalink
Make __getitem__ handle slice for Python 3
Browse files Browse the repository at this point in the history
Python 3 doesn't have __getslice__ instead it uses __getitem__ with a
slice object.
  • Loading branch information
msabramo committed Jun 16, 2014
1 parent 04b2c8e commit 8fde5f3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions smmap/buf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def __len__(self):
return self._size

def __getitem__(self, i):
if isinstance(i, slice):
return self.__getslice__(i.start or 0, i.stop or self._size)
c = self._c
assert c.is_valid()
if i < 0:
Expand Down

0 comments on commit 8fde5f3

Please sign in to comment.