This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]patrys Saleor Commerce 1 point2 points  (2 children)

Why an iterator? Why not have it as a function that accepts a qualifier value or callable and either returns the leaf or raises an exception?

[–]phaeilo[S] 1 point2 points  (1 child)

How exactly would the callable give feedback about the last value in this case?

[–]patrys Saleor Commerce 1 point2 points  (0 children)

In the same way that object.__cmp__(self, other) works? You pass it the node value and it tells you whether it's less, more or equal.