Python3: sorting image objects according to a cmp function

Poor Yorick org.python.python-list at pooryorick.com
Wed Dec 3 09:06:02 EST 2008


I'm looking for a Python3-compatible way to sort a list of PIL image objects
based on a computed difference between the two images. In 2.x, this would
work:

    imagelist.sort(cmp=image_diff(a,b))

Maybe this could be done by creating a new class with the appropriate __lt__,
____gt__, __eq__ methods, but that seems like more work than should be
necessary.  Any suggestions?

-- 
Yorick



More information about the Python-list mailing list