Sure, generators rock! :-)
2009/4/1 andrew cooke <and...@acooke.org>: > Nico Grubert wrote: >>> May be not so much pythonic, but works >>> >>> for i in range(len(q)): >>> for x in q[i:]: >>> if x.startswith(q[i]) and x!=q[i]: >>> q.remove(x) >> >> ...but works fine. Thanks, Eugene. >> Also thanks to Andrew. Your example works fine, too. Thanks to remind me >> of the 'yield' statement! ;-) > > in case it's not clear, the method above is O(n^2) while mine was O(n). > that will not matter for small lists, but for long ones mine will be much > faster. > > andrew > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Sincerely yours, Eugene Perederey > -- Sincerely yours, Eugene Perederey -- http://mail.python.org/mailman/listinfo/python-list