--- George Sakkis <[EMAIL PROTECTED]> wrote:
> > It seems > > like it would be fairly straightforward to do a > quick > > prototype implementation of this. I'm off to work > > soon, so I can't do it today, but maybe Sunday. > > I'm afraid I beat you to it :) > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/521877 Well done. Can I suggest a minor optimization? Instead of this... def get_predicate(arg): return arg if callable(arg) else ( arg.__eq__ if hasattr(arg,'__eq__') else lambda item: item == arg) ...would this be faster?: if not callable(start): start = lambda arg: (arg.__eq__ if hasattr(... # then start iterating Also, you haven't completely ruined my Sunday plans, because I think I could enhance the cookbook example by providing an alternative implementation that works on finite lists, to show the less sophisticated (but also less functional) approach to this problem. But maybe somebody will beat me to that as well... ____________________________________________________________________________________ We won't tell. Get more on shows you hate to love (and love to hate): Yahoo! TV's Guilty Pleasures list. http://tv.yahoo.com/collections/265 -- http://mail.python.org/mailman/listinfo/python-list