2011-09-13から1日間の記事一覧
夕方にちょっと話にでてきたので想像で実装してみた。 class ExtensibleComparator(object): def __init__(self): self.ops = [] def __call__(self, x, y): for op in self.ops: n = op(x, y) if n == -1: return -1 elif n == 1: return 1 return 0 def ad…
夕方にちょっと話にでてきたので想像で実装してみた。 class ExtensibleComparator(object): def __init__(self): self.ops = [] def __call__(self, x, y): for op in self.ops: n = op(x, y) if n == -1: return -1 elif n == 1: return 1 return 0 def ad…