Skip to content

Commit

Permalink
Added general __len__ implementation for Element
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Feb 13, 2017
1 parent 25b6a1c commit 3fe9d39
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions holoviews/core/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@ def array(self, dimensions=[]):
return np.column_stack(columns)


def __len__(self):
"""
Elements must define a length, by default will simply be
computed from dimension values, subclasses may override this
for efficiency and correctness.
"""
return len(self.dimension_values(0))



class Tabular(Element):
"""
Expand Down

0 comments on commit 3fe9d39

Please sign in to comment.