On Fri, Sep 28, 2012 at 6:59 PM, Demian Brecht <demianbre...@gmail.com> wrote:
>> f = filter(lambda s: s == a[-1], a)
>
> That line's assuming that the last element may also be found in arbitrary 
> locations in the list. If it's guaranteed that they're all contiguous at the 
> upper bounds, I'd just walk the list backwards until I found one that wasn't 
> matching rather than filtering.

The slicing operation in the second line assumes that they're all
collected at the end of the list anyway.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to