> You've merely replaced the 'test n<0' with 'not check' at the expense > of an additional parameter that has to be passed each time (and the > additional test 'n<0' for the first iteration). > -- > http://mail.python.org/mailman/listinfo/python-list > I think you have missed the point. The OP stated that n<0 could stand for an expensive operation, this replaces an expensive check every time with a cheaper one every time.
I like the idea of the interface that was in the original post. Cheers, -- http://mail.python.org/mailman/listinfo/python-list