On Fri, Sep 28, 2012 at 8:29 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> The slicing operation in the second line assumes that they're all > collected at the end of the list anyway. > True enough. Hadn't considered otherwise when I first whipped that off with the first example (thinking/trying it out *before* posting would likely be a good idea ;)). >>> a = ['z'*5, 'b', 'a', 'c', 'z'*5] >>> b = filter(lambda n: n == a[-1], a) >>> c = filter(lambda n: n != a[-1], a) >>> d = sorted(c) + b ['a', 'b', 'c', 'zzzzz', 'zzzzz'] It does the trick for what he was asking in the original question, although there are likely more optimal solutions for a sufficiently large a. As Steven noted, it definitely would help to get a little more information about the specific problem.
-- http://mail.python.org/mailman/listinfo/python-list