Skip to content

Commit

Permalink
Within a View, we avoid generating new Trees, Leaves.
Browse files Browse the repository at this point in the history
  • Loading branch information
dotsdl committed Mar 16, 2016
1 parent f24675e commit 5e6298c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/datreant/core/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ def __getitem__(self, index):
elif isinstance(index, string_types):
# a name can be used for indexing
# always returns a View
out = View([self.abspaths[i] for i, name
out = View([self._list()[i] for i, name
in enumerate(self.names) if name == index])

elif isinstance(index, slice):
# we also take slices, obviously
out = View(*self.abspaths[index])
out = View(*self._list()[index])
else:
raise IndexError("Cannot index View with given values")

Expand Down

0 comments on commit 5e6298c

Please sign in to comment.