Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added method: STree.leaves_by_pred(..)

  • Loading branch information...
commit 031640ef0fa6f28d59895675fa076e4ed7c61184 1 parent ff20062
Erez Shin authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 plyplus/strees.py
View
5 plyplus/strees.py
@@ -116,7 +116,10 @@ def leaf(self, leaf_head, default=KeyError):
return r
def leaves(self, leaf_head):
- return STreeCollection(x for x in self.tail if x.head == leaf_head)
+ return self.leaves_by_pred(lambda x: x.head == leaf_head)
+
+ def leaves_by_pred(self, pred):
+ return STreeCollection(filter(pred, self.tail))
def calc_parents(self):
for i, kid in enumerate(self.tail):
Please sign in to comment.
Something went wrong with that request. Please try again.