2010/10/17 Rob Hooft <r...@hooft.net>: > En zo? > > class Window(object): > def __init__(self, n): > self.n = n > > def __call__(self, list): > ret = [] > for i in list: > if len(ret) == self.n: > yield ret > ret = ret[1:] > ret.append(i) > if len(ret) == self.n: > yield ret > > lijst = [1, 2, 3, 3, 4, 10 , 3 ,2, 2, 1] > > w=Window(3) > for three in w(lijst): > print three
Waarom gebruik je hier een class? Je kan die hele __call__() gewoon als functie schrijven. Cheers, Dirkjan _______________________________________________ Python-nl mailing list Python-nl@python.org http://mail.python.org/mailman/listinfo/python-nl